The LCD touchscreen used by the MCBSTM32F400 evaluation board is a resistive film giving a resolution of 4000 × 4000 (that is, far greater than the GLCD). This recipe extends touchScreenDemo_c2v0
and illustrates how to use the LCD touchscreen.
Perform the following steps to use the LCD touchscreen:
Return to
touchScreenDemo_c2v0
and open the project.Use the RTE manager to add Software Component → Board Support for the Graphic LCD (in addition to the Touchscreen). Click Resolve and then OK.
Open
touchScreenDemo.c
, and include the following headers:#include <stdio.h> #include "stm32f4xx_hal.h" #include "cmsis_os.h" #include "Driver_I2C.h" #include "Board_GLCD.h" #include "GLCD_Config.h" #include "Board_Touch.h"
Define the following macros, global variables, and function prototypes:
// The size of the touch-screen co-ordinates system. #define SCREEN_TS_WIDTH 4000 #define SCREEN_TS_HEIGHT 4000 #define wait_delay HAL_Delay /* Globals */ extern GLCD_FONT...