Hey everyone,
Since a few days I am working with the STM32F746G-Discovery Board from ST.
For my application, I would like to use the GUI Builder and create some Windows
with Buttons and Images.
I successfully implemented the GUI library from ST and created a nice starting
screen with only one button.
The problem is, I am struggling with the handling of touch events.
The only thing I changed so far is, that inside of the WindowDLG.c file
(created by the GUI Builder) I added one line of code.
When I start the GUI and press the Button, nothing happens...
Inside of my main.c I initialize the Touch Screen like this:
Display All
In addition to that, I call the following function every 50ms:
Display All
I got this code from the Internet. I figured out, that I need this to upgrade
the Touch status and the x and y position of the touch itself.
I also send a String to my computer every time, I touch the screen.
#### To sum it up:
What do I need to change inside of the main so that the added line inside my
WindowDLG.c file gets executed?
(Do I need to do any additional configurations of the touchscreen? Do I need to
put the created GUI somehow in the foreground? How do I need to change the BSP_Pointer_Update Function?)
I really hope that somebody of you could help me. I cannot find any good
examples or tutorials about this issue which explain the WHOLE problem.
Kind regards
Sören
Since a few days I am working with the STM32F746G-Discovery Board from ST.
For my application, I would like to use the GUI Builder and create some Windows
with Buttons and Images.
I successfully implemented the GUI library from ST and created a nice starting
screen with only one button.
The problem is, I am struggling with the handling of touch events.
The only thing I changed so far is, that inside of the WindowDLG.c file
(created by the GUI Builder) I added one line of code.
When I start the GUI and press the Button, nothing happens...
Inside of my main.c I initialize the Touch Screen like this:
C Source Code
In addition to that, I call the following function every 50ms:
C Source Code
- void BSP_Pointer_Update(void) {
- uint8_t text[20] = "Hello World!\n\r";
- GUI_PID_STATE TS_State;
- static TS_StateTypeDef prev_state;
- TS_StateTypeDef ts;
- uint16_t xDiff, yDiff;
- BSP_TS_GetState(&ts);
- TS_State.Pressed = ts.touchDetected;
- xDiff = (prev_state.touchX > ts.touchX) ?
- (prev_state.touchX -
- ts.touchX) : (ts.touchX - prev_state.touchX);
- yDiff = (prev_state.touchY > ts.touchY) ?
- (prev_state.touchY -
- ts.touchY) : (ts.touchY - prev_state.touchY);
- if(prev_state.touchDetected > 0){
- HAL_UART_Transmit(&huart1, text, 20,
- 100);
- }
- if ((prev_state.touchDetected != ts.touchDetected) || (xDiff
- > 3)
- || (yDiff > 3)) {
- prev_state.touchDetected =
- ts.touchDetected;
- if ((ts.touchX != 0) &&
- (ts.touchY != 0)) {
- prev_state.touchX[0] =
- ts.touchX[0];
- prev_state.touchY[0] =
- ts.touchY[0];
- }
- GUI_TOUCH_StoreStateEx(&TS_State);
- }
- }
I got this code from the Internet. I figured out, that I need this to upgrade
the Touch status and the x and y position of the touch itself.
I also send a String to my computer every time, I touch the screen.
#### To sum it up:
What do I need to change inside of the main so that the added line inside my
WindowDLG.c file gets executed?
(Do I need to do any additional configurations of the touchscreen? Do I need to
put the created GUI somehow in the foreground? How do I need to change the BSP_Pointer_Update Function?)
I really hope that somebody of you could help me. I cannot find any good
examples or tutorials about this issue which explain the WHOLE problem.
Kind regards
Sören