This section shows how to configure the TouchGFX Generator to generate a TouchGFX HAL that uses one of the following Frame Buffer strategies:
Choosing Single Buffer as the buffering strategy developers are able to let the compiler allocate memory for the framebuffer in internal RAM but can also choose a specific location for the buffer.
When choosing By Allocation TouchGFX Generator will allocate an array based on the dimensions and bitdepth of the application.
Code is generated to configure the HAL to use this array as the framebuffer.
When choosing By Address for the location of the framebuffer TouchGFX Generator will use the specified Start Addresses during HAL initialization.
In a double frame buffer configuration, code to swap farmebuffers will be generated in the HAL by TouchGFX Generator depending on the selected Framebuffer strategy and display interface. This memory interface to frame buffer location is used by the TouchGFX Engine during the main event loop.
When choosing By Address TouchGFX Generator will use the two specified Start Addresses during HAL initialization.
When choosing By Allocation TouchGFX Generator will allocate an array based on the dimensions and bitdepth of the application, exactly as with a Single Frame Buffer, only twice the size.
Selecting the Partial Buffer strategy allows developers to choose a number of blocks and a size for each of these to be used as frame buffers. This strategy uses what TouchGFX calls a Frame Buffer Allocator and is different from supplying either a pointer to external memory where the frame buffer is located, or allocating a fixed sized array in internal memory.
See the article on Framebuffer for a general overview of the concept of frame buffers.
Since a partial buffering strategy is typically only used with low cost MCU with no TFT controller and little internal RAM the Partial Buffer Strategy expects the developer to implement the transfer of the contents of the framebuffer to the display. See FMC/SPI Scenario for how to transmit pixels to e.g. a serial display on MCUs with no TFT Controller.
In order to synchronize with TouchGFX when using the Partial Framebuffer strategy developers are required to provide implementations for the following two functions. The code displayed below is generated by CubeMX inside
TouchGFX/target/generated/TouchGFXGeneratedHAL.cpp and defines the interface from developer to the TouchGFX Engine.
The following function is also generated by CubeMX inside the read-only
TouchGFXGeneratedHAL class inside