Skip to content

File syn_oled.h

FileList > display > syn_oled.h

Go to the source code of this file

Generic Monochrome OLED Display Driver (SSD1306, SH1106, SSD1309 over I2C).

  • #include "../common/syn_defs.h"
  • #include "../display/syn_canvas.h"
  • #include "../drivers/syn_soft_i2c.h"
  • #include <stdbool.h>
  • #include <stddef.h>
  • #include <stdint.h>

Classes

Type Name
struct SYN_OLED
Generic OLED Display Instance Context.

Public Types

Type Name
enum SYN_OLEDType
OLED Controller IC Type.

Public Functions

Type Name
void syn_oled_canvas_flush_cb (const uint8_t * buf, size_t len, void * ctx)
Canvas flush callback matching SYN_Canvas_FlushFn signature.
void syn_oled_flush_canvas (SYN_OLED * oled, const SYN_Canvas * c)
Flush canvas pixel buffer to physical OLED display screen.
SYN_Status syn_oled_init (SYN_OLED * oled, SYN_GPIO_Pin scl, SYN_GPIO_Pin sda, uint8_t i2c_addr, uint16_t w, uint16_t h, SYN_OLEDType type)
Initialize Monochrome OLED display context.
void syn_oled_set_contrast (SYN_OLED * oled, uint8_t contrast)
Set display contrast level.
void syn_oled_set_display_on (SYN_OLED * oled, bool on)
Turn display ON or OFF (power save mode).
void syn_oled_set_invert (SYN_OLED * oled, bool invert)
Set display color inversion.

Public Types Documentation

enum SYN_OLEDType

OLED Controller IC Type.

enum SYN_OLEDType {
    SYN_OLED_SSD1306 = 0,
    SYN_OLED_SH1106 = 1,
    SYN_OLED_SSD1309 = 2
};


Public Functions Documentation

function syn_oled_canvas_flush_cb

Canvas flush callback matching SYN_Canvas_FlushFn signature.

void syn_oled_canvas_flush_cb (
    const uint8_t * buf,
    size_t len,
    void * ctx
) 

Parameters:

  • buf Framebuffer byte array.
  • len Byte array length.
  • ctx Context pointer (SYN_OLED instance).

function syn_oled_flush_canvas

Flush canvas pixel buffer to physical OLED display screen.

void syn_oled_flush_canvas (
    SYN_OLED * oled,
    const SYN_Canvas * c
) 

Parameters:

  • oled OLED context.
  • c Source Canvas context.

function syn_oled_init

Initialize Monochrome OLED display context.

SYN_Status syn_oled_init (
    SYN_OLED * oled,
    SYN_GPIO_Pin scl,
    SYN_GPIO_Pin sda,
    uint8_t i2c_addr,
    uint16_t w,
    uint16_t h,
    SYN_OLEDType type
) 

Parameters:

  • oled OLED context.
  • scl I2C SCL GPIO pin.
  • sda I2C SDA GPIO pin.
  • i2c_addr I2C slave address (e.g. 0x3C or 0x3D).
  • w Width in pixels (e.g. 128).
  • h Height in pixels (e.g. 64 or 32).
  • type OLED IC Controller type (SSD1306, SH1106, SSD1309).

Returns:

SYN_OK on success.


function syn_oled_set_contrast

Set display contrast level.

void syn_oled_set_contrast (
    SYN_OLED * oled,
    uint8_t contrast
) 

Parameters:

  • oled OLED context.
  • contrast Contrast level (0 to 255).

function syn_oled_set_display_on

Turn display ON or OFF (power save mode).

void syn_oled_set_display_on (
    SYN_OLED * oled,
    bool on
) 

Parameters:

  • oled OLED context.
  • on True for display ON.

function syn_oled_set_invert

Set display color inversion.

void syn_oled_set_invert (
    SYN_OLED * oled,
    bool invert
) 

Parameters:

  • oled OLED context.
  • invert True for inverted display (black on white).


The documentation for this class was generated from the following file src/syntropic/display/syn_oled.h