Skip to main content
Vins
Associate III
November 12, 2021
Solved

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

  • November 12, 2021
  • 3 replies
  • 868 views

..

This topic has been closed for replies.
Best answer by MM..1

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;
}

3 replies

MM..1
Super User
November 12, 2021

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.

Vins
VinsAuthor
Associate III
November 15, 2021

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?

MM..1
MM..1Best answer
Super User
November 15, 2021

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;
}