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
PIN11toIIC2_SCLandPIN12toIIC2_SDAInitialize SSD1306 using the default address
0x3CDraw 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#
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.
Common SSD1306 addresses are
0x3Cor0x3D. This example defaults to0x3C.
Tip
For I2C interface details, please refer to the I2C API documentation.
