Skip to main content
Use the framebuffer API to implement displays (LCD, OLED, e-paper, etc.). The display size is defined in the .chip.json file. The framebuffer uses 32 bits per pixel. The pixels are stored in the RGBA format. The total size of the buffer is pixel_width * pixel_height * 4 bytes.

framebuffer_init

Returns the framebuffer for the current chip, and the pixel dimensions (width/height) of the frame buffer.
Note: framebuffer_init can only be called from chip_init(). Do not call it at a later time.

buffer_write

Copies data_len bytes from data into the frame buffer, at the given offset.

buffer_read

Copies data_len bytes at the given offset of the frame buffer into data.

Simulator examples