cancel
Showing results for 
Search instead for 
Did you mean: 

Code structure for terminal application?

Martin294
Associate III

Hello all,

I have used TouchGFX for one project before (see https://www.eevblog.com/forum/projects/high-voltage-electronic-load-(500v-500ma)/msg4833872/#msg4833872)

which was lots of trial and error, following some tutorials. I still find the architecture (MVP) pretty confusing, so this time I am asking for your help to set this up properly:

I want to build a user interface module (based on an existing module like STM32F469I DISCO) that displays pre-defined screens. It will be connected to a host via a fast serial link (UART or SPI). From the host, it might get commands like

Switch to screen 2

Put text "asdfasdf" in text field 23

set gauge 17 to value 1234... you get the idea.

In the opposite direction the UI module should send messages for UI events like

button 5 pressed

slider 8 set to value 123

How do I structure the code? I'll have CodeMX generate the HAL interface for a full duplex UART, generating interrupts for received  characters. From there, a message handler would collect the charaters and execute a command once a terminator (end of line) would be received. 

In examples, I have seen FreeRTOS queues for a communication like that - why would one want to do that? Why not directly from the message handler call a function like "set gauge to value 123"?

 

Thanks! Martin

0 REPLIES 0