2022-08-30 04:22 AM
Hi...
By using Text Area widget a string is displayed on a 480x272 resolution board. But I want something like, if we give '1' from keyboard through usart that data will be transmitted & it should display a string configured in TOUCHGFX IDE .I tried it by enabling usart pins configure in polling mode & in switch case when character is received it should display a configured string .
switch(Usart_Buffer)
{
case '1' :
unicode::strncpy(textArea1Buffer,"Power on",7);
textArea1.invalidate();
break;
}
I am not getting what is the proper way to do this ?
Solved! Go to Solution.
2022-09-14 03:30 AM
Hello @PM.5 ,
I did a simple example for you on the STM32F746G-DISCO board, I will join it to this post.
To explain quickly what I did for making it work :
void Model::tick()
{
uint8_t pData[1] = {0};
if (HAL_UART_Receive(&huart1, pData, 1, 10) == HAL_OK)
{
modelListener->updateCharacter(pData[0]);
}
}
void Screen1Presenter::updateCharacter(char character)
{
view.updateCharacter(character);
}
void Screen1View::updateCharacter(char character)
{
Unicode::strncpy(textArea1Buffer, &character , 1);
textArea1.invalidate();
}
Now, if you wanna try it out, you can use a tool like Putty for simulating the UART value transmission part :
This project could be improved, for example by using interrupts instead, but I think that might be a good start for you.
Hope that it helped,
/Yoann
2022-09-14 03:30 AM
Hello @PM.5 ,
I did a simple example for you on the STM32F746G-DISCO board, I will join it to this post.
To explain quickly what I did for making it work :
void Model::tick()
{
uint8_t pData[1] = {0};
if (HAL_UART_Receive(&huart1, pData, 1, 10) == HAL_OK)
{
modelListener->updateCharacter(pData[0]);
}
}
void Screen1Presenter::updateCharacter(char character)
{
view.updateCharacter(character);
}
void Screen1View::updateCharacter(char character)
{
Unicode::strncpy(textArea1Buffer, &character , 1);
textArea1.invalidate();
}
Now, if you wanna try it out, you can use a tool like Putty for simulating the UART value transmission part :
This project could be improved, for example by using interrupts instead, but I think that might be a good start for you.
Hope that it helped,
/Yoann