Detailed information are described in Datasheet SSD1306.
C library is aimed for driving 0.96" OLED display with SSD1306 driver 128x64 through TWI's Atmega328p.
- 1.0 - basic functions. The first publication.
- 2.0 - more changes:
- rebuild to cacheMemLcd array. It means that every request is stored in cache array and then is depicted on the display by function SSD1306_UpdateScreen (uint8_t).
- Added new function -> SSD1306_DrawLine (uint8_t, uint8_t, uint8_t, uint8_t). Possible depicted any line (horizontal, vertical, with slope).
- Possible to use for more than 1 display (not tested, cause displays that I have avialable had the same addresses).
Font.c can be modified according to application requirements with form defined in font.c. Maximal permissible horizontal dimension is 8 bits.
Prior defined for MCU Atmega328p / Atmega8 / Atmega16. Need to be carefull with TWI ports definition.
PORT | Atmega16 | Atmega8 / Atmega328 |
---|---|---|
SCL | PC0 | PC5 |
SDA | PC1 | PC4 |
Library was tested and proved on 0.96″ OLED Display with SSD1306 driver and Atmega328p.
Init sequence OLED display was defined according to page 64 (next to last page) of Datasheet SSD1306.
// +---------------------------+
// | Set MUX Ratio |
// +---------------------------+
// | 0xA8, 0x3F |
// +---------------------------+
// |
// +---------------------------+
// | Set Display Offset |
// +---------------------------+
// | 0xD3, 0x00 |
// +---------------------------+
// |
// +---------------------------+
// | Set Display Start Line |
// +---------------------------+
// | 0x40 |
// +---------------------------+
// |
// +---------------------------+
// | Set Segment Remap |
// +---------------------------+
// | 0xA0 / 0xA1 |
// +---------------------------+
// |
// +---------------------------+
// | Set COM Output Scan |
// | Direction |
// +---------------------------+
// | 0xC0 / 0xC8 |
// +---------------------------+
// |
// +---------------------------+
// | Set COM Pins hardware |
// | configuration |
// +---------------------------+
// | 0xDA, 0x02 |
// +---------------------------+
// |
// +---------------------------+
// | Set Contrast Control |
// +---------------------------+
// | 0x81, 0x7F |
// +---------------------------+
// |
// +---------------------------+
// | Disable Entire Display On |
// +---------------------------+
// | 0xA4 |
// +---------------------------+
// |
// +---------------------------+
// | Set Normal Display |
// +---------------------------+
// | 0xA6 |
// +---------------------------+
// |
// +---------------------------+
// | Set Osc Frequency |
// +---------------------------+
// | 0xD5, 0x80 |
// +---------------------------+
// |
// +---------------------------+
// | Enable charge pump |
// | regulator |
// +---------------------------+
// | 0x8D, 0x14 |
// +---------------------------+
// |
// +---------------------------+
// | Display On |
// +---------------------------+
// | 0xAF |
// +---------------------------+
- SSD1306_Init (uint8_t) - Init display
- SSD1306_ClearScreen (void) - Clear screen
- SSD1306_NormalScreen (uint8_t) - Normal screen
- SSD1306_InverseScreen (uint8_t) - Inverse screen
- SSD1306_SetPosition (uint8_t, uint8_t) - Set position
- SSD1306_DrawChar (char) - Draw specific character
- SSD1306_DrawString (char*) - Draw specific string
- SSD1306_UpdateScreen (uint8_t) - Update content on display
- SSD1306_DrawLine (uint8_t, uint8_t, uint8_t, uint8_t) - Draw line