跳转至

CFBD_OLED_IICInitsParams

Module: OLED Display Integration

Initialization parameters for OLED devices using I2C. More...

#include <external_impl_driver.h>

Public Attributes

Name
CFBD_I2CHandle * i2cHandle
Pointer to the I2C handle used for communication.
uint32_t accepted_time_delay
Minimum or accepted time delay (units implementation-defined).
uint16_t device_address
7-bit or 8-bit I2C device address depending on backend.
CFBD_OLED_DeviceSpecific * device_specifics
Pointer to device-specific configuration and callbacks.
void(*)(int status) iic_transition_callback
Optional callback invoked on I2C transaction transitions.

Detailed Description

struct CFBD_OLED_IICInitsParams;

Initialization parameters for OLED devices using I2C.

Par:

  • Field Relationships

All fields must be properly initialized before passing to OLED_Init():

  • i2cHandle must point to an initialized I2C bus
  • device_address must match the actual hardware (0x3C or 0x3D typical)
  • device_specifics must match the actual display model
  • iic_transition_callback may be NULL if polling is acceptable
  • Example - Complete Initialization
// Create and configure the initialization structure
CFBD_OLED_IICInitsParams params;

// Get I2C bus handle (configured by board layer)
params.i2cHandle = get_i2c1_handle();

// Configure device-specific parameters
params.device_address = 0x3C;
params.accepted_time_delay = 5;           // 5 ticks between ops
params.device_specifics = get_ssd1306_config();
params.iic_transition_callback = on_iic_complete;

// Initialize OLED
int result = OLED_Initialize(&params);

Aggregates the I2C handle, device address, timing parameters and a pointer to device-specific data required by the OLED driver. The optional iic_transition_callback can be supplied by the platform to receive status updates about I2C transaction completion.

Public Attributes Documentation

variable i2cHandle

CFBD_I2CHandle * i2cHandle;

Pointer to the I2C handle used for communication.

Note: The I2C handle remains owned by the board/platform layer. The OLED driver does not take ownership or close it.

This should point to a valid [CFBD_I2CHandle](Classes/structCFBD__I2CHandle.md) provided by the project's I2C driver (lib/iic). The handle must be already initialized before passing to the OLED driver.

variable accepted_time_delay

uint32_t accepted_time_delay;

Minimum or accepted time delay (units implementation-defined).

Note: The actual timing behavior depends on the OLED driver implementation and the platform's timer/scheduler.

Used by the driver to schedule retries or throttling between transactions. Interpret the unit according to the platform's timing conventions (milliseconds, ticks, scheduler quantum, etc.).

Typical values:

  • 0-1: No delay (fast polling systems)
  • 1-5: Minimal delay (cooperative multitasking)
  • 5-10: Small delay (allows other tasks to run)
  • 10+: Significant delay (low-priority display updates)

variable device_address

uint16_t device_address;

7-bit or 8-bit I2C device address depending on backend.

Note: The actual interpretation (7-bit vs 8-bit) is backend-specific. Consult the I2C driver documentation for address format.

Par: Example - Address Selection by Hardware

// Check SA0 pin to determine address
#ifdef OLED_SA0_HIGH
    params.device_address = 0x3D;
#else
    params.device_address = 0x3C;
#endif

Standard OLED display addresses:

  • 0x3C: Most common (SSD1306, SSD1309 default)
  • 0x3D: Alternative address (if SA0 pin tied high)

variable device_specifics

CFBD_OLED_DeviceSpecific * device_specifics;

Pointer to device-specific configuration and callbacks.

See: CFBD_OLED_DeviceSpecific

Note: Must not be NULL. The OLED driver requires this to be properly initialized for the specific hardware model.

Implementation-defined structure describing device parameters such as display geometry, command set quirks, or initialization sequences. The concrete type is [CFBD_OLED_DeviceSpecific](Classes/structCFBD__OLED__DeviceSpecific.md).

Device-specific data typically includes:

  • Display resolution (width, height in pixels)
  • Controller model (SSD1306, SSD1309, SH1106)
  • Initialization command sequences
  • Timing constants (frame rate, refresh rate)
  • Feature flags (supports DMA, contrast adjustment, etc.)

variable iic_transition_callback

void(*)(int status) iic_transition_callback;

Optional callback invoked on I2C transaction transitions.

See: CFBD_I2C_AsyncCallback

Note: May be NULL if the application does not require async notification. In that case, the driver may use polling or ignore completion status.

Par: Callback Pattern - Async Notification

void on_display_event(int status) {
    if (status == I2C_OK) {
        // Display command executed
        update_display_state();
    } else {
        // Display error
        increment_error_counter();
        schedule_retry();
    }
}

params.iic_transition_callback = on_display_event;

The callback receives an integer status describing the result of a transaction (semantics are platform-defined). Use this to signal completion or error conditions back to the application.

Typical status values:

  • I2C_OK: Transaction succeeded
  • I2C_ERR_NACK: Device not responding
  • I2C_ERR_TIMEOUT: Operation timed out
  • I2C_ERR_BUSY: Bus busy, retry needed

Updated on 2026-02-03 at 13:21:55 +0000