cancel
Showing results for 
Search instead for 
Did you mean: 

stm32H7B3l-EVAL custom screen with GT911_tc interface not able to see liberary

lStilloadingl
Associate II

I am currently working on stm32H7B3l-EVAL having currently gotten a custom screen to work over RGB interface but I am having problems with the touch interface. The board comes with FT5336 touch controller and having tried to modify the registers to match the GOODIX-GT911 documentation. when logic analyzer is coupled on the connector the correct start address is sent but no ACK is received.
I found this GT911 library on github ---https://github.com/DiveInEmbedded/GT911-Touch-driver/tree/main

I got this working on the board without touch GFX but when I try to use the library with the STM32TouchController.Cpp The inclusion of GT911.h does not give any errors but all the internal functions from GT911.c gives errors as seen in included pictures. I have tried several guides because I have a gut feeling that the tgfx touch controller file still cannot see the driver fully.

is there a easy way to get external library to work with the STM32TouchController.Cpp or is there a easier way to choose a touch controller. I am  open for suggestions on a "universal" way of including libraries with tgfx and or debugging/understanding file structure.

 

 

Setup wise i am using the same connector as the original display using I2C2 and ribbon cable for RGB interface.

1 ACCEPTED SOLUTION

Accepted Solutions
JTP1
Lead

Hello

For me it looks that you are trying to call function from Cpp module which is located in C module. Maybe you need to add extern "C" to the C module function definitions, like this in GT911.h:

extern "C" GT911_Status_t GT911_ReadTouch(TouchCordinate_t* cordinate, uint8_t* number_of_cordinate);

One way to do it is to add some definition before including .h to cpp, like

#define INC_FROM_CPP
#include "GT911.h"

and then in GT911.h check this definition like:

#ifdef INC_FROM_CPP
extern "C" GT911_Status_t GT911_ReadTouch(TouchCordinate_t* cordinate, uint8_t* number_of_cordinate);

#else
GT911_Status_t GT911_ReadTouch(TouchCordinate_t* cordinate, uint8_t* number_of_cordinate);

#endif

Then functions can called from C or Cpp modules. Add all functions as extern which you are calling from cpp.

Hope this helps.

Br JTP

 

View solution in original post

2 REPLIES 2
JTP1
Lead

Hello

For me it looks that you are trying to call function from Cpp module which is located in C module. Maybe you need to add extern "C" to the C module function definitions, like this in GT911.h:

extern "C" GT911_Status_t GT911_ReadTouch(TouchCordinate_t* cordinate, uint8_t* number_of_cordinate);

One way to do it is to add some definition before including .h to cpp, like

#define INC_FROM_CPP
#include "GT911.h"

and then in GT911.h check this definition like:

#ifdef INC_FROM_CPP
extern "C" GT911_Status_t GT911_ReadTouch(TouchCordinate_t* cordinate, uint8_t* number_of_cordinate);

#else
GT911_Status_t GT911_ReadTouch(TouchCordinate_t* cordinate, uint8_t* number_of_cordinate);

#endif

Then functions can called from C or Cpp modules. Add all functions as extern which you are calling from cpp.

Hope this helps.

Br JTP

 

yeah fixed it but now the TGFX code halts on HAL_Delay(); ...... but at least I am at a point where I can troubleshoot.
much appreciated help 🙂

 

and for future people looking at the post, I fixed it by doing the same as the FT5336 code does, by putting everything in the .h file in 

 

#ifdef __cplusplus

extern "C" {

#endif

 

 

 //code here

 

#ifdef __cplusplus

}

#endif