cancel
Showing results for 
Search instead for 
Did you mean: 

How to integrate my own .c files to Touch GFX generated code?

Vins
Senior
 
1 ACCEPTED SOLUTION

Accepted Solutions

Better explai your question in normal TouchGFX is implemented with RTOS and your c code is run as next thread .

Then you hav etwo ways howto send values to GUI.

  1. Use queue messages RTOS system from one thread to other, examples in TouchGFX docu. Good for multicore MCUS.
  2. Simpler method on single core RTOS run, is create for example struct with shared values between GUI and other threads and use it simply for example in handletick , struct is created in c and included as extern c in view.cpp
 if (tickCounter % 2 == 0 && lastvalue != SharedStruct.newvalue) {
    	imageProgressL.setValue(SharedStruct.newvalue);
     lastvalue = SharedStruct.newvalue;
}

View solution in original post

3 REPLIES 3
MM..1
Chief II

Why c files, GFX is cpp. Or better is your project managed only in designer or you use IDE ?

In normal IDE is used for custom projects and all files need be added to for example core or gui folders, not to in name generated files/folders.

Then project refresh show new files and manage make.

If only designer is used , is required manual edit makefiles usw... beter is use existed files only.

Hi @MM..1​ Thanks for your reply.

I have my sensor application code in .c. I want to show the sensor values on display. My working sensor application is in STM32CubeIDE and getting the values on Tera Term (UART). So, how to integrate Touch GFX generated code to my sensor code and show the output on display?

Better explai your question in normal TouchGFX is implemented with RTOS and your c code is run as next thread .

Then you hav etwo ways howto send values to GUI.

  1. Use queue messages RTOS system from one thread to other, examples in TouchGFX docu. Good for multicore MCUS.
  2. Simpler method on single core RTOS run, is create for example struct with shared values between GUI and other threads and use it simply for example in handletick , struct is created in c and included as extern c in view.cpp
 if (tickCounter % 2 == 0 && lastvalue != SharedStruct.newvalue) {
    	imageProgressL.setValue(SharedStruct.newvalue);
     lastvalue = SharedStruct.newvalue;
}