Hello,
the following explanations assumes that you are familiar with the example DeviceIntegration. You can use that as foundation.
Step 1: Within the file DeviceDriver.c make the following adaptations.
Remove the AdcWorkerThread() and create instead a UartWokerThread() with the following content:
static void UartWorkerThread( const void* arg )
{
char ch = 0;
while ( DeviceInitialized )
{
/* read one characer from the uart */
ch = EwBspConsoleGetCharacter();
/*
Important note: This function is a separate thread/task and not executed
in the context of the main GUI thread/task. NEVER make a direct function
call to a method of the driver class or any other generated code
from an interrupt handler or any other thread/task.
EwInvoke() or EwInvokeCopy() have to be used to schedule the invocation of
the desired method in the context of the GUI thread/task.
*/
if ((( ch >= 'A' ) && ( ch <= 'Z' )) || (( ch >= 'a' ) && ( ch <= 'z' ))
|| (( ch >= '0' ) && ( ch <= '9' )) || ( ch == ' ' ))
EwInvokeCopy( UpdateUartCharProc, &ch, sizeof( char ));
/* sleep for a certain period... */
EwBspOsDelay( 20 );
}
/* terminate the worker thread */
WorkerThread = 0;
EwBspOsThreadDestroy( EwBspOsThreadGetHandle());
}
Don't forget to add the following include at the beginning of the file DeviceDriver.c:
#include "ew_bsp_console.h"
And adapt the following define:
/*
In order to ensure that the example code of this module is only compiled
and linked to the example 'DeviceIntegration', we check for generated defines.
*/
#if ( defined _ApplicationDeviceClass__TriggerHardButtonEvent_ && defined _ApplicationDeviceClass__UpdateUartChar_ )
#define DEVICE_INTEGRATION_EXAMPLE
#endif
Step 2: Within Embedded Wizard Studio, open the example DeviceIntegration, navigate to the class Application::DeviceClass and replace the Property AdcValue by a Property UartChar:


Step 3: Now, open the class Application::Application and add a new TextView to show your UART characters. Name it to UartText. Remove the Adc PropertyObserver and add a new PropertyObserver for the UART:
The Property Outlet of the UartCharObserver should refer to ^Application::Device.UartChar to get triggered each time a new character is received. And set the Property OnEvent to the slot method onUartCharEvent which is responsible to add the received string to the text view.
Now you can try to run that on your target. I hope this brief explanation helps.
For more details let me recommend to study our online documentation:
Best regards,
Manfred