2024-08-17 02:57 AM
I am using STM32F469i-Disco board with a custom DSI video mode LCD interface and TouchGFX.
The display is working and renders the initial screen, however the screen is not being updated.
I know the reason for this is because I am having difficulty defining the call to OSWrappers::signalVSync() from the LTDC_IRQHandler() function in stm32f4xx_it.c, this is a requirement to unblock the TouchGFX Engine main loop. The LTDC interrupt is enabled and the function LTDC_IRQHandler() is being called (established by debug).
My software skills are not that strong and the problem that I am having is not understanding how to call the C++ function OSWrappers::signalVSync() from the C function LTDC_IRQHandler().
The TouchGFX manual shows an example for the STM32F7 as follows:
Implementing this code in the STM32F4xx LTDC_IRQHandler() results in a syntax error when the directive extern "C" is encountered.
I have included OSWrappers.hpp in my code and set the apropriate include paths for both GNU C and GNU C++ in the Eclipse project properties.
On building the project there are various C++ compilation errors which I think relate to the include of OSWrappers.hpp in stm32f4xx_it.c.
I suspect that there is something I am not understanding about calling the C++ OSWrapper function from C code, any assistance would be greatly appreciated.
Solved! Go to Solution.
2024-08-18 02:12 PM
My brilliant colleague Charlie solved this for me by creating a new C++ wrapper writen in C++, this means that it can call other C++ functions but has it's functions defined as extern "C" so that they can in turn be called from C code.
So here is how it's done for the STM32F469i.
In folder Project>Core>Src create a new file "touchgfx_wrapper.cpp" containg the following code:-
#include <touchgfx/hal/OSWrappers.hpp>
extern "C" {
void signalVSync(void) {
touchgfx::OSWrappers::signalVSync();
}
}
In folder Project>Core>Inc create header file "touchgfx_wrapper.h" containing the following
void signalVSync(void);
In stm32f4xx_it.c, add #include "touchgfx_wrapper.h" to the user includes section
In stm32f4xx_it.c add the call to signalVSync() in the function LTDC_IRQHandler()
All working now with the LCD updating at the frame rate. Thanks Charlie!
2024-08-18 02:12 PM
My brilliant colleague Charlie solved this for me by creating a new C++ wrapper writen in C++, this means that it can call other C++ functions but has it's functions defined as extern "C" so that they can in turn be called from C code.
So here is how it's done for the STM32F469i.
In folder Project>Core>Src create a new file "touchgfx_wrapper.cpp" containg the following code:-
#include <touchgfx/hal/OSWrappers.hpp>
extern "C" {
void signalVSync(void) {
touchgfx::OSWrappers::signalVSync();
}
}
In folder Project>Core>Inc create header file "touchgfx_wrapper.h" containing the following
void signalVSync(void);
In stm32f4xx_it.c, add #include "touchgfx_wrapper.h" to the user includes section
In stm32f4xx_it.c add the call to signalVSync() in the function LTDC_IRQHandler()
All working now with the LCD updating at the frame rate. Thanks Charlie!