Note

This is the documentation for the latest development branch and may refer to features that are not available in released versions. If you are looking for the documentation for a specific release, use the drop-down menu on the left and select the desired version.

I2C SSD1306 Example#

Introduction#

This example demonstrates driving an SSD1306 OLED via I2C: initializing the display, drawing a test pattern, and refreshing the display.

Source code location: src/rtsmart/examples/peripheral/i2c_ssd1306/test_i2c_ssd1306.c

Example Behavior#

  • Fixed use of I2C2 (bus=2, 400kHz)

  • Fixed mapping of PIN11 to IIC2_SCL and PIN12 to IIC2_SDA

  • Initialize SSD1306 using the default address 0x3C

  • Draw and display a checkerboard test pattern

Key Interfaces#

  • drv_fpioa_set_pin_func()

  • drv_i2c_inst_create() / drv_i2c_inst_destroy()

  • drv_i2c_transfer()

Build and Run#

cd src/rtsmart/examples/peripheral/i2c_ssd1306
make
./test_i2c_ssd1306

This example takes no command-line arguments.

Notes#

  1. The I2C pins and bus number in the example are hard-coded. If the wiring on your development board differs, please modify the source code first.

  2. Common SSD1306 addresses are 0x3C or 0x3D. This example defaults to 0x3C.

Tip

For I2C interface details, please refer to the I2C API documentation.

Comments list
Comments
Log in