Module display_mod

Module display_mod 

Source
Expand description

Module for the Screen

The embedded_graphics library is used to render 2D graphics to the screen. Examples for how to use the library can be found here.

The STM32G491KE has 512 Kbytes of Flash memory, and 112 Kbytes of SRAM. Because of the low memory constraints, a framebuffer cannot be used.

§How rendering works

The ILIxxxx IC drivers operate using commands and data. The command list can be found here

What happens is the following:

  • A drawing window is prepared (with the 2 opposite corner coordinates), using three commands.
  • The starting point for drawint is the top left corner of this window
  • Every set of bytes received is intepreted as a pixel value in the current display format (Rgb666, Rgb565, etc.). How pixels are formatted into bytes depends on the display format and interface type. More information can be found in the Display Data Format section of the ILI9488 datasheet.
  • As soon as a pixel is received, an internal counter is incremented, and the next word will fill the next pixel (the adjacent on the right, or the first of the next row if the row ended)

§Optimization Strategies

  1. The hardware is optimized for drawing rectangles. So prefer rendering rectangles over other shapes.
  2. If a text/gui element’s state does not change between render frames, do not redraw it.
  3. Numbers that are rendered on each frame (e.g speed, temperature) should use the seven-segment display font. The reason for this is because the seven-segment font is rendered using multiple horizontal/veritcal lines (rectangles), source.

Constants§

CENTER_POINT
DISPLAY_HEIGHT
DISPLAY_WIDTH

Functions§

display_task
Responsible for rendering data to the display

Type Aliases§

DisplayDevice
Type Alias for ILI9488 driver, the current display driver