TB2026-YDS Firmware
Loading...
Searching...
No Matches
OLED display (SSD1333)

Panel init and full-frame RGB565 blit over SPI. More...

Collaboration diagram for OLED display (SSD1333):

Macros

#define DISPLAY_OLED_BRIGHTNESS_MAX   15

Functions

esp_err_t display_oled_init (spi_device_handle_t spi)
 Reset the panel and run the SSD1333 init sequence (gamma, contrast, display on).
esp_err_t display_oled_draw (const uint8_t *buf, size_t len)
 Blit a full framebuffer to the panel.
esp_err_t display_oled_clear (void)
 Clear the panel to black directly, without a framebuffer.
esp_err_t display_oled_set_brightness (uint8_t level)
 Set the global panel brightness (SSD1333 Master Current, cmd 0xC7).
esp_err_t display_oled_sleep (void)
 Put the panel to sleep (SSD1333 Display OFF, cmd 0xAE).
esp_err_t display_oled_wake (void)
 Wake the panel from sleep (SSD1333 Display ON, cmd 0xAF).

Detailed Description

Panel init and full-frame RGB565 blit over SPI.

Macro Definition Documentation

◆ DISPLAY_OLED_BRIGHTNESS_MAX

#define DISPLAY_OLED_BRIGHTNESS_MAX   15

Highest brightness level accepted by display_oled_set_brightness().

Function Documentation

◆ display_oled_clear()

esp_err_t display_oled_clear ( void )

Clear the panel to black directly, without a framebuffer.

Returns
ESP_OK on success, or the SPI error.

◆ display_oled_draw()

esp_err_t display_oled_draw ( const uint8_t * buf,
size_t len )

Blit a full framebuffer to the panel.

Streams the whole 176x176 RAM window, byte-swapping each native RGB565 pixel to the panel's MSB-first order.

Parameters
bufFramebuffer, native-order RGB565, GFX_W*GFX_H pixels.
lenByte length; must equal 176*176*2.
Returns
ESP_OK on success, ESP_ERR_INVALID_SIZE if len is wrong, or the SPI error.

◆ display_oled_init()

esp_err_t display_oled_init ( spi_device_handle_t spi)

Reset the panel and run the SSD1333 init sequence (gamma, contrast, display on).

Configures the D/C# and RST GPIOs, pulses reset, then sends the datasheet init sequence. Must be called once before any draw.

Parameters
spiSPI device handle for the panel (from spi_bus_display_init()).
Returns
ESP_OK on success, or the GPIO/SPI error.

◆ display_oled_set_brightness()

esp_err_t display_oled_set_brightness ( uint8_t level)

Set the global panel brightness (SSD1333 Master Current, cmd 0xC7).

Scales the segment output current uniformly across all colours, so it dims the whole picture without shifting the colour balance – and lowers the panel's current draw, which matters on battery. The init sequence leaves this at the maximum; call this to override it.

Runs on the caller's task; call from the UI task only (same task as display_oled_draw()), never concurrently with a blit.

Parameters
level0 (dimmest) .. DISPLAY_OLED_BRIGHTNESS_MAX (brightest); clamped.
Returns
ESP_OK on success, or the SPI error.

◆ display_oled_sleep()

esp_err_t display_oled_sleep ( void )

Put the panel to sleep (SSD1333 Display OFF, cmd 0xAE).

Blanks the output and drops the panel to its ~2 µA sleep current; the RAM contents and all configuration are retained, so display_oled_wake() restores the last frame with no re-init and no redraw. Building block for a future screen auto-off / sleep policy – this driver applies no timeout of its own.

Not serialised internally: call it from the same task as display_oled_draw() (the UI task), never concurrently with a blit.

Returns
ESP_OK on success, or the SPI error.

◆ display_oled_wake()

esp_err_t display_oled_wake ( void )

Wake the panel from sleep (SSD1333 Display ON, cmd 0xAF).

Undoes display_oled_sleep(); the previously shown frame reappears. Same task constraint as display_oled_sleep().

Returns
ESP_OK on success, or the SPI error.