...
This application note explains how to run a sample GUI on the LCD, from the FreeRTOS demo application.
1. Understanding FreeRTOS LCD Interfaces
1.1. FreeRTOS LCD Implementation
The FreeRTOS BSP makes use of the STM32CubeH7 software component to provide a device driver for the LCD controller. The driver is configured (enabled / disabled) at the BSP build time, using the HAL_LTDC_MODULE_ENABLED
configuration option, defined in the stm32h7xx_hal_conf.h
file.
The display video frame buffer resides in SDRAM, in a non-cached memory region. Depending on the value of the configGUI_INITIALIZED
build-time parameter defined in the FreeRTOSConfig.h
file, the driver initialises the LCD controller (configGUI_INITIALIZED
is equal 1) or rely on the LCD controller settings defined by U-boot.
1.2. FreeRTOS LCD C-Binding API
The display driver implements the following C-binding API:
Function | Description | Comments |
| Initialise LCD and backlight | |
| De-initialise LCD and backlight | |
| Return LCD width in pixels | |
| Return LCD height in pixels | |
| Set frame buffer address of layer | |
| Activate layer | |
| Fill frame buffer with color Color | |
| Turn LCD on | |
| Turn LCD off | |
| Set LCD brightness |
|
1.3. LCD CLI Command
The FreeRTOS application implements the following display related CLI command:
Command | Description | Comments |
| Write a certain graphical pattern to the LCD display |
2. Understanding FreeRTOS Touch Panel Interfaces
2.1. FreeRTOS Touch Panel Implementation
The FreeRTOS BSP makes use of the STM32CubeH7 software component to provide a device driver for the I2C touch controller. The driver is configured (enabled / disabled) at the BSP build time, using the HAL_I2C_MODULE_ENABLED
configuration option, defined in the stm32h7xx_hal_conf.h
file.
2.2. FreeRTOS Touch Panel C-Binding API
The touch driver implements the following C-binding API:
...
Code Block |
---|
typedef struct { I2C_HandleTypeDef * hi2c; /* handle to the I2C interface */ uint16_t devid; /* device id of the I2C touch controller */ uint16_t i2c_addr; /* I2C address of the I2C touch controller */ uint32_t cfg_len; /* length of the configuration data */ uint16_t max_width; /* max width resolution */ uint16_t max_height; /* max heigth resolution */ } ts_goodix_handler; |
3. Understanding Sample GUI
3.1. Sample GUI Implementation
The FreeRTOS test application implements a separate thread called GUI thread, which provides a sample GUI application running on the LCD display and the touch panel controller.
...
Write a test pattern to the LCD display.
Initialise the touch controller driver, and then run an endless loop that waits for interrupts from the touch controller and, upon each touch event, print to the serial console a message with detailed information on the touch event.
In addition to the printing of the message with detailed information on the touch event, touching the display panel changes the shown picture between the two images. One of them is drawn using the DMA2D Chrom-Art Accelerator, the other fills the display frame buffer directly.
3.2. Sample GUI Session
Perform the following step-wise procedure, to validate the sample GUI functionality:
...