SSD1306 OLED display driver
1.7.1
This library is developed to control SSD1306/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
|
LCD initialization and service functions. More...
Classes | |
struct | ssd1306_lcd_t |
Macros | |
#define | s_displayHeight ssd1306_lcd.height |
#define | s_displayWidth ssd1306_lcd.width |
#define | g_lcd_type ssd1306_lcd.type |
#define | ssd1306_setRamBlock ssd1306_lcd.set_block |
Sets block in RAM of lcd display controller to write data to. More... | |
#define | ssd1306_nextRamPage ssd1306_lcd.next_page |
#define | ssd1306_sendPixels ssd1306_lcd.send_pixels1 |
#define | ssd1306_sendPixelsBuffer ssd1306_lcd.send_pixels_buffer1 |
#define | ssd1306_sendPixel8 ssd1306_lcd.send_pixels8 |
Sends RGB pixel encoded in 3-3-2 format to OLED driver. Sends RGB pixel encoded in 3-3-2 format to OLED driver. More... | |
Enumerations | |
enum | lcd_type_t { LCD_TYPE_SSD1306, LCD_TYPE_PCD8544, LCD_TYPE_SH1106, LCD_TYPE_SSD1331, LCD_TYPE_CUSTOM } |
enum | lcd_mode_t { LCD_MODE_NORMAL = 0, LCD_MODE_SSD1306_COMPAT = 1 } |
Functions | |
void | ssd1306_sendData (uint8_t data) __attribute__((deprecated)) |
void | ssd1306_configureI2cDisplay (const uint8_t *config, uint8_t configSize) |
Sends configuration being passed to lcd display i2c/spi controller. More... | |
void | ssd1306_configureSpiDisplay (const uint8_t *config, uint8_t configSize) |
Sends configuration being passed to lcd display spi controller. More... | |
void | ssd1306_setMode (lcd_mode_t mode) |
Sets library display mode for direct draw functions. More... | |
uint8_t | ssd1306_displayHeight (void) |
uint8_t | ssd1306_displayWidth (void) |
Variables | |
ssd1306_lcd_t | ssd1306_lcd |
void | il9163_setMode (lcd_mode_t mode) |
Sets GDRAM autoincrement mode. More... | |
void | il9163_128x128_init (void) |
Inits 128x128 RGB OLED display (based on il9163 controller). More... | |
void | st7735_128x160_init (void) |
Inits 128x160 RGB OLED display (based on st7735 controller). More... | |
void | il9163_128x128_spi_init (int8_t rstPin, int8_t cesPin, int8_t dcPin) |
Inits 128x128 RGB TFT display over spi (based on il9163 controller). More... | |
void | st7735_128x160_spi_init (int8_t rstPin, int8_t cesPin, int8_t dcPin) |
Inits 128x160 RGB TFT display over spi (based on st7735 controller). More... | |
void | pcd8544_84x48_init (void) |
Inits 84x48 LED display (based on PCD8544 controller). More... | |
void | pcd8544_84x48_spi_init (int8_t rstPin, int8_t cesPin, int8_t dcPin) |
void | sh1106_128x64_init (void) |
Inits 128x64 OLED display (based on SH1106 controller). More... | |
void | sh1106_128x64_i2c_init (void) |
Inits 128x64 OLED display over i2c (based on SH1106 controller). More... | |
void | sh1106_128x64_spi_init (int8_t rstPin, int8_t cesPin, int8_t dcPin) |
Inits 128x64 OLED display over spi (based on SH1106 controller). More... | |
void | ssd1306_128x64_init (void) |
Inits 128x64 OLED display (based on SSD1306 controller). More... | |
void | ssd1306_128x64_i2c_init (void) |
Inits 128x64 OLED display over i2c (based on SSD1306 controller). More... | |
void | ssd1306_128x64_i2c_initEx (int8_t scl, int8_t sda, int8_t sa) |
Inits 128x64 OLED display over i2c (based on SSD1306 controller). More... | |
void | ssd1306_128x64_spi_init (int8_t rstPin, int8_t cesPin, int8_t dcPin) |
Inits 128x64 OLED display over spi (based on SSD1306 controller). More... | |
void | ssd1306_init (void) __attribute__((deprecated)) |
Inits 128x64 OLED display over i2c (based on SSD1306 controller). More... | |
void | ssd1306_128x32_i2c_init (void) |
Inits 128x32 OLED display over i2c (based on SSD1306 controller). More... | |
void | ssd1306_128x32_init (void) |
Inits 128x32 OLED display (based on ssd1306 controller). More... | |
void | ssd1331_setMode (lcd_mode_t mode) |
Sets GDRAM autoincrement mode. More... | |
void | ssd1331_96x64_init (void) |
Inits 96x64 RGB OLED display (based on SSD1331 controller). More... | |
void | ssd1331_96x64_spi_init (int8_t rstPin, int8_t cesPin, int8_t dcPin) |
Inits 96x64 RGB OLED display over spi (based on SSD1331 controller). More... | |
void | ssd1351_setMode (lcd_mode_t mode) |
Sets GDRAM autoincrement mode. More... | |
void | ssd1351_128x128_init (void) |
Inits 128x128 RGB OLED display (based on SSD1351 controller). More... | |
void | ssd1351_128x128_spi_init (int8_t rstPin, int8_t cesPin, int8_t dcPin) |
Inits 128x128 RGB OLED display over spi (based on SSD1351 controller). More... | |
void | vga_96x40_8colors_init (void) |
Inits 96x40 color VGA display. More... | |
void | vga_128x64_mono_init (void) |
Inits 128x64 monochrome VGA display. More... | |
LCD initialization and service functions.
This group contains API functions for OLED displays initialization and direct programming of GDRAM. This API can be used to create your own graphics functions.
#define g_lcd_type ssd1306_lcd.type |
Current selected lcd display type
Definition at line 181 of file lcd_common.h.
#define s_displayHeight ssd1306_lcd.height |
Current display height
Definition at line 169 of file lcd_common.h.
#define s_displayWidth ssd1306_lcd.width |
Current display width
Definition at line 175 of file lcd_common.h.
#define ssd1306_nextRamPage ssd1306_lcd.next_page |
Switches to the start of next RAM page for the block, specified by ssd1306_setRamBlock(). For ssd1306 it does nothing, while for sh1106 the function moves cursor to next page.
Definition at line 217 of file lcd_common.h.
#define ssd1306_sendPixel8 ssd1306_lcd.send_pixels8 |
Sends RGB pixel encoded in 3-3-2 format to OLED driver. Sends RGB pixel encoded in 3-3-2 format to OLED driver.
data | - byte, representing RGB8 pixel. |
Definition at line 240 of file lcd_common.h.
#define ssd1306_sendPixels ssd1306_lcd.send_pixels1 |
Sends 8 monochrome vertical pixels to OLED driver.
data | - byte, representing 8 pixels. |
Definition at line 224 of file lcd_common.h.
#define ssd1306_sendPixelsBuffer ssd1306_lcd.send_pixels_buffer1 |
Sends buffer containing 8 monochrome vertical pixels, encoded in each byte.
buffer | - buffer containing monochrome pixels. |
len | - length of buffer in bytes. |
Definition at line 232 of file lcd_common.h.
#define ssd1306_setRamBlock ssd1306_lcd.set_block |
Sets block in RAM of lcd display controller to write data to.
Sets block in RAM of lcd display controller to write data to. For ssd1306 it uses horizontal addressing mode, while for sh1106 the function uses page addressing mode. Width can be specified as 0, thus the library will set the right boundary to region of RAM block to the right column of the display.
x | - column (left region) |
y | - page (top page of the block) |
w | - width of the block in pixels to control |
Definition at line 208 of file lcd_common.h.
enum lcd_mode_t |
Available lcd modes used by the library. LCD_MODE_SSD1306_COMPAT is compatible mode, which should be used with standard monochrome functions.
Definition at line 69 of file lcd_common.h.
enum lcd_type_t |
Enumeration, describing display type
Definition at line 50 of file lcd_common.h.
void il9163_128x128_init | ( | void | ) |
Inits 128x128 RGB OLED display (based on il9163 controller).
Inits 128x128 RGB OLED display (based on il9163 controller). User must init communication interface (i2c, spi) prior to calling this function.
Definition at line 218 of file lcd_il9163.c.
void il9163_128x128_spi_init | ( | int8_t | rstPin, |
int8_t | cesPin, | ||
int8_t | dcPin | ||
) |
Inits 128x128 RGB TFT display over spi (based on il9163 controller).
Inits 128x128 RGB TFT display over spi (based on il9163 controller)
rstPin | - pin controlling LCD reset (-1 if not used) |
cesPin | - chip enable pin to LCD slave (-1 if not used) |
dcPin | - data/command pin to control LCD dc (required) |
Definition at line 233 of file lcd_il9163.c.
void il9163_setMode | ( | lcd_mode_t | mode | ) |
Sets GDRAM autoincrement mode.
Sets GDRAM autoincrement mode. By default, to make ssd1306_xxx functions compatible with RGB oled display, RGB oled is initialized in vertical auto-increment mode. But for pure rbg oled operations horizontal auto-increment mode is more suitable. So, if you're going to use NanoCanvas8 functions, please call il9163_setMode(0) prior to using pure RGB methods.
mode | 0 or 1 |
Definition at line 163 of file lcd_il9163.c.
void pcd8544_84x48_init | ( | void | ) |
Inits 84x48 LED display (based on PCD8544 controller).
Inits 84x48 LED display (based on PCD8544 controller). User must init communication interface (i2c, spi) prior to calling this function.
Definition at line 72 of file lcd_pcd8544.c.
void pcd8544_84x48_spi_init | ( | int8_t | rstPin, |
int8_t | cesPin, | ||
int8_t | dcPin | ||
) |
Inits 84x48 LED display over spi (based on PCD8544 controller)
rstPin | - pin controlling LCD reset (-1 if not used) |
cesPin | - chip enable pin to LCD slave (-1 if not used) |
dcPin | - data/command pin to control LCD dc (required) |
Definition at line 92 of file lcd_pcd8544.c.
void sh1106_128x64_i2c_init | ( | void | ) |
Inits 128x64 OLED display over i2c (based on SH1106 controller).
Inits 128x64 OLED display over i2c (based on SH1106 controller) This function uses hardcoded pins for i2c communication, depending on your hardware. If you use non-standard pins in your project, please perform call ssd1306_i2cInitEx() and sh1106_128x64_init().
Definition at line 106 of file oled_sh1106.c.
void sh1106_128x64_init | ( | void | ) |
Inits 128x64 OLED display (based on SH1106 controller).
Inits 128x64 OLED display (based on SH1106 controller). User must init communication interface (i2c or spi) prior to calling this function.
Definition at line 90 of file oled_sh1106.c.
void sh1106_128x64_spi_init | ( | int8_t | rstPin, |
int8_t | cesPin, | ||
int8_t | dcPin | ||
) |
Inits 128x64 OLED display over spi (based on SH1106 controller).
Inits 128x64 OLED display over spi (based on SH1106 controller)
rstPin | - pin controlling LCD reset (-1 if not used) |
cesPin | - chip enable pin to LCD slave (-1 if not used) |
dcPin | - data/command pin to control LCD dc (required) |
Definition at line 112 of file oled_sh1106.c.
void ssd1306_128x32_i2c_init | ( | void | ) |
Inits 128x32 OLED display over i2c (based on SSD1306 controller).
Inits 128x32 OLED display over i2c (based on SSD1306 controller) This function uses hardcoded pins for i2c communication, depending on your hardware. If you use non-standard pins in your project, please perform call ssd1306_i2cInitEx() and ssd1306_128x32_init().
Definition at line 185 of file oled_ssd1306.c.
void ssd1306_128x32_init | ( | void | ) |
Inits 128x32 OLED display (based on ssd1306 controller).
Inits 128x32 OLED display (based on ssd1306 controller) spi or i2c bus must be initialized prior to calling this function.
Definition at line 169 of file oled_ssd1306.c.
void ssd1306_128x64_i2c_init | ( | void | ) |
Inits 128x64 OLED display over i2c (based on SSD1306 controller).
Inits 128x64 OLED display over i2c (based on SSD1306 controller) This function uses hardcoded pins for i2c communication, depending on your hardware. If you use non-standard pins in your project, please perform call ssd1306_i2cInitEx() and ssd1306_128x64_init(), or you can use ssd1306_128x64_i2c_initEx().
Definition at line 132 of file oled_ssd1306.c.
void ssd1306_128x64_i2c_initEx | ( | int8_t | scl, |
int8_t | sda, | ||
int8_t | sa | ||
) |
Inits 128x64 OLED display over i2c (based on SSD1306 controller).
Inits 128x64 OLED display over i2c (based on SSD1306 controller) This function uses hardcoded pins for i2c communication, depending on your hardware.
scl | - i2c clock pin. Use -1 if you don't need to change default pin number |
sda | - i2c data pin. Use -1 if you don't need to change default pin number |
sa | - i2c address of lcd display. Use 0 to leave default |
Definition at line 138 of file oled_ssd1306.c.
void ssd1306_128x64_init | ( | void | ) |
Inits 128x64 OLED display (based on SSD1306 controller).
Inits 128x64 OLED display (based on SSD1306 controller). User must init communication interface (i2c, spi) prior to calling this function.
Definition at line 116 of file oled_ssd1306.c.
void ssd1306_128x64_spi_init | ( | int8_t | rstPin, |
int8_t | cesPin, | ||
int8_t | dcPin | ||
) |
Inits 128x64 OLED display over spi (based on SSD1306 controller).
Inits 128x64 OLED display over spi (based on SSD1306 controller)
rstPin | - pin controlling LCD reset (-1 if not used) |
cesPin | - chip enable pin to LCD slave (-1 if not used) |
dcPin | - data/command pin to control LCD dc (required) |
Definition at line 148 of file oled_ssd1306.c.
void ssd1306_configureI2cDisplay | ( | const uint8_t * | config, |
uint8_t | configSize | ||
) |
Sends configuration being passed to lcd display i2c/spi controller.
Sends configuration being passed to lcd display i2c/spi controller. The data bytes are sent to lcd controller as is. In case of spi display this function sends cmd arguments in command mode. If lcd controller requires arguments to be sent in data mode, please use ssd1306_configureSpiDisplay().
config | configuration, located in flash, to send to i2c/spi controller. |
configSize | - size of configuration data in bytes. |
Definition at line 41 of file lcd_common.c.
void ssd1306_configureSpiDisplay | ( | const uint8_t * | config, |
uint8_t | configSize | ||
) |
Sends configuration being passed to lcd display spi controller.
Sends configuration being passed to lcd display spi controller. If data byte value to be sent is less than 255, then data byte is sent in command mode. If data byte is 0xFF, the function does't send it to controller, but switches to spi data mode, and next byte after will be sent in data spi mode. Then the function will switch back to command mode. If lcd controller requires cmd arguments to be sent in command mode, please use ssd1306_configureI2cDisplay().
config | configuration, located in flash, to send to i2c/spi controller. |
configSize | - size of configuration data in bytes. |
Definition at line 52 of file lcd_common.c.
uint8_t ssd1306_displayHeight | ( | void | ) |
Returns display height in pixels
Definition at line 48 of file ssd1306_generic.c.
uint8_t ssd1306_displayWidth | ( | void | ) |
Returns display width in pixels
Definition at line 53 of file ssd1306_generic.c.
void ssd1306_init | ( | void | ) |
Inits 128x64 OLED display over i2c (based on SSD1306 controller).
Inits 128x64 OLED display over i2c (based on SSD1306 controller) This function uses hardcoded pins for i2c communication, depending on your hardware. If you use non-standard pins in your project, please perform call ssd1306_i2cInitEx() and ssd1306_128x64_init(), or you can use ssd1306_128x64_i2c_initEx().
Definition at line 110 of file oled_ssd1306.c.
void ssd1306_sendData | ( | uint8_t | data | ) |
Sends byte data to SSD1306 controller memory. Performs 3 operations at once: ssd1306_intf.start(), ssd1306_intf.send(), ssd1306_intf.stop();
data | - byte to send to the controller memory |
Definition at line 34 of file lcd_common.c.
void ssd1306_setMode | ( | lcd_mode_t | mode | ) |
Sets library display mode for direct draw functions.
Sets library display mode for direct draw functions. There are currently 2 modes supported: LCD_MODE_SSD1306_COMPAT and LCD_MODE_NORMAL. In general, ssd1306 compatible mode uses different GDRAM addressing mode, than normal mode, intended for using with RBG full-color functions.
mode | lcd mode to activate. |
Definition at line 74 of file lcd_common.c.
void ssd1331_96x64_init | ( | void | ) |
Inits 96x64 RGB OLED display (based on SSD1331 controller).
Inits 96x64 RGB OLED display (based on SSD1331 controller). User must init communication interface (i2c, spi) prior to calling this function.
Definition at line 195 of file oled_ssd1331.c.
void ssd1331_96x64_spi_init | ( | int8_t | rstPin, |
int8_t | cesPin, | ||
int8_t | dcPin | ||
) |
Inits 96x64 RGB OLED display over spi (based on SSD1331 controller).
Inits 96x64 RGB OLED display over spi (based on SSD1331 controller)
rstPin | - pin controlling LCD reset (-1 if not used) |
cesPin | - chip enable pin to LCD slave (-1 if not used) |
dcPin | - data/command pin to control LCD dc (required) |
Definition at line 212 of file oled_ssd1331.c.
void ssd1331_setMode | ( | lcd_mode_t | mode | ) |
Sets GDRAM autoincrement mode.
Sets GDRAM autoincrement mode. By default, to make ssd1306_xxx functions compatible with RGB oled display, RGB oled is initialized in vertical auto-increment mode. But for pure rbg oled operations horizontal auto-increment mode is more suitable. So, if you're going to use NanoCanvas8 functions, please call ssd1331_setMode(0) prior to using pure RGB methods.
mode | 0 or 1 |
Definition at line 126 of file oled_ssd1331.c.
void ssd1351_128x128_init | ( | void | ) |
Inits 128x128 RGB OLED display (based on SSD1351 controller).
Inits 128x128 RGB OLED display (based on SSD1351 controller). User must init communication interface (i2c, spi) prior to calling this function.
Definition at line 171 of file oled_ssd1351.c.
void ssd1351_128x128_spi_init | ( | int8_t | rstPin, |
int8_t | cesPin, | ||
int8_t | dcPin | ||
) |
Inits 128x128 RGB OLED display over spi (based on SSD1351 controller).
Inits 128x128 RGB OLED display over spi (based on SSD1351 controller)
rstPin | - pin controlling LCD reset (-1 if not used) |
cesPin | - chip enable pin to LCD slave (-1 if not used) |
dcPin | - data/command pin to control LCD dc (required) |
Definition at line 202 of file oled_ssd1351.c.
void ssd1351_setMode | ( | lcd_mode_t | mode | ) |
Sets GDRAM autoincrement mode.
Sets GDRAM autoincrement mode. By default, to make ssd1306_xxx functions compatible with RGB oled display, RGB oled is initialized in vertical auto-increment mode. But for pure rbg oled operations horizontal auto-increment mode is more suitable. So, if you're going to use NanoCanvas8 functions, please call ssd1351_setMode(0) prior to using pure RGB methods.
mode | 0 or 1 |
Definition at line 117 of file oled_ssd1351.c.
void st7735_128x160_init | ( | void | ) |
Inits 128x160 RGB OLED display (based on st7735 controller).
Inits 128x160 RGB OLED display (based on st7735 controller). User must init communication interface (i2c, spi) prior to calling this function.
Definition at line 354 of file lcd_il9163.c.
void st7735_128x160_spi_init | ( | int8_t | rstPin, |
int8_t | cesPin, | ||
int8_t | dcPin | ||
) |
Inits 128x160 RGB TFT display over spi (based on st7735 controller).
Inits 128x160 RGB TFT display over spi (based on st7735 controller)
rstPin | - pin controlling LCD reset (-1 if not used) |
cesPin | - chip enable pin to LCD slave (-1 if not used) |
dcPin | - data/command pin to control LCD dc (required) |
Definition at line 369 of file lcd_il9163.c.
void vga_128x64_mono_init | ( | void | ) |
Inits 128x64 monochrome VGA display.
Inits 128x64 monochrome VGA display. This mode supports 2 colors: black and white. User must init communication interface (uart) for vga client mode or init vga interface for host mode prior to calling this function.
Definition at line 134 of file vga_monitor.c.
void vga_96x40_8colors_init | ( | void | ) |
Inits 96x40 color VGA display.
Inits 96x40 color VGA display. This mode supports 8 colors: 3 bits per pixel. User must init communication interface (uart) for vga client mode or init vga interface for host mode prior to calling this function.
Definition at line 121 of file vga_monitor.c.
ssd1306_lcd_t ssd1306_lcd |
Structure containing callback to low level function for currently enabled display
Definition at line 32 of file lcd_common.c.