TouchGFX getting GUI user input data to FreeRTOS
I am trying to get user input from the GUI to FreeRTOS. The text area buffer is transferred from my screen1View, to screen1Presenter, to model then added to a queue. Finally, my task in FreeRTOS will check for new data in the queue every 1 second.
The problem now is the received data. The user input in gui is 57346,the text area display this number correctly i.e. no space in between the numbers. But in my ucData[10] buffer, a 0 space exist in between the number i.e. 5070304060. How can I correctly transfer the user input to my main.c? Where is the cause for this ? Thank you!
Other code information below if relevant.
Screen1View.cpp
void Screen1View::doUpdatePIDParam()
{
presenter->doUpdatePIDParamB(
textArea_PBuffer,
textArea_IBuffer,
textArea_DBuffer,
textArea_TargetBuffer);
}Screen1Presenter.cpp
void Screen1Presenter::doUpdatePIDParamB(
Unicode::UnicodeChar *bufferP,
Unicode::UnicodeChar *bufferI,
Unicode::UnicodeChar *bufferD,
Unicode::UnicodeChar *bufferTarget)
{
model->doUpdatePIDParamC(bufferP, bufferI, bufferD, bufferTarget);
}Model.cpp
#include <gui/model/Model.hpp>
#include <gui/model/ModelListener.hpp>
#include <cmsis_os.h>
#include "FreeRTOS.h"
#include "queue.h"
#include "task.h"
struct AMessage
{
char ucData[ 10 ];
} xMessage;
extern "C"{
xQueueHandle messageQ3;
}
Model::Model() : modelListener(0)
{
messageQ3 = xQueueCreate(10,sizeof( &xMessage ) );
}
void Model::tick()
{
}
void Model::doUpdatePIDParamC(
unsigned short *bufferP,
unsigned short *bufferI,
unsigned short *bufferD,
unsigned short *bufferTarget)
{
struct AMessage *pxPointerToxMessage;
*(xMessage.ucData) =*bufferP;
xQueueSend(messageQ3,( void * ) &pxPointerToxMessage,( TickType_t ) 0 );
}
main.c
extern xQueueHandle messageQ3;
struct AMessage
{
char ucData[ 10 ];
} xMessage;
struct AMessage *pxRxedPointer;
void taskGetGui(void *argument)
{
osDelay(5000); //begin checking queue 5 seconds after kernel starts
char msg1[10]; //buffer to store user input from gui
for(;;)
{
if( messageQ3 != NULL )
{if( xQueueReceive( messageQ3,&( pxRxedPointer ),( TickType_t ) 10 ) == pdPASS )
{
/* *pxRxedPointer now points to xMessage. */
}
}
osDelay(1000);
}
}