SSD1306 OLED display driver 1.8.2 This library is developed to control SSD1306/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays

Classes | Macros | Enumerations | Functions | Variables
OLEDs: initialization and service functions

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...
#define | SSD1306_COMPAT_SPI_BLOCK_8BIT_CMDS(column_cmd, row_cmd)
#define | CONTROLLER_NATIVE_SPI_BLOCK_8BIT_CMDS(column_cmd, row_cmd)
#define | SSD1306_COMPAT_SEND_PIXELS_RGB8_CMDS()
#define | SSD1306_COMPAT_SEND_PIXELS_RGB16_CMDS()

## 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_configureSpiDisplay2 (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...
void | ssd1306_resetController (int8_t rstPin, uint8_t delayMs)
| Does hardware reset for oled controller. More...
lcduint_t | ssd1306_displayHeight (void)
lcduint_t | ssd1306_displayWidth (void)

## Variables
ssd1306_lcd_t | ssd1306_lcd
void | composite_video_128x64_mono_init (void)
| Inits 128x64 monochrome VGA display. More...
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 | il9163_setOffset (lcdint_t x, lcdint_t y)
| Sets screen offset (refer to datasheet of your display) 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 | ili9341_setMode (lcd_mode_t mode)
| Sets GDRAM autoincrement mode. More...
void | ili9341_240x320_init (void)
| Inits 240x320 RGB OLED display (based on ili9341 controller). More...
void | ili9341_240x320_spi_init (int8_t rstPin, int8_t cesPin, int8_t dcPin)
| Inits 240x320 RGB TFT display over spi (based on ili9341 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_128x32_spi_init (int8_t rstPin, int8_t cesPin, int8_t dcPin)
| Inits 128x32 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 | ssd1306_displayOff (void)
void | ssd1306_displayOn (void)
void | ssd1306_setContrast (uint8_t contrast)
void | ssd1306_invertMode (void)
void | ssd1306_normalMode (void)
void | ssd1306_flipHorizontal (uint8_t mode)
| performs horizontal flip More...
void | ssd1306_flipVertical (uint8_t mode)
| performs vertical flip More...
void | ssd1306_setStartLine (uint8_t line)
uint8_t | ssd1306_getStartLine (void)
void | ssd1325_setMode (lcd_mode_t mode)
| Sets GDRAM autoincrement mode. More...
void | ssd1325_128x64_init (void)
| Inits 128x64 SSD1325 OLED display (based on SSD1325 controller). More...
void | ssd1325_128x64_spi_init (int8_t rstPin, int8_t cesPin, int8_t dcPin)
| Inits 128x64 SSD1325 OLED display over spi (based on SSD1325 controller). More...
void | ssd1327_128x128_init (void)
| Inits 128x128 SSD1327 OLED display (based on SSD1327 controller). More...
void | ssd1327_128x128_spi_init (int8_t rstPin, int8_t cesPin, int8_t dcPin)
| Inits 128x128 SSD1327 OLED display over spi (based on SSD1327 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 in 8-bit mode (based on SSD1331 controller). More...
void | ssd1331_96x64_spi_init16 (int8_t rstPin, int8_t cesPin, int8_t dcPin)
| Inits 96x64 RGB OLED display over spi in 16-bit mode (based on SSD1331 controller). More...
void | ssd1331_drawLine (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint16_t color)
void | ssd1331_copyBlock (uint8_t left, uint8_t top, uint8_t right, uint8_t bottom, uint8_t newLeft, uint8_t newTop)
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 | template_setMode (lcd_mode_t mode)
| Sets GDRAM autoincrement mode. More...
void | template_WxH_init (void)
| Inits WxH TEMPLATE OLED display (based on TEMPLATE controller). More...
void | template_WxH_spi_init (int8_t rstPin, int8_t cesPin, int8_t dcPin)
| Inits WxH TEMPLATE OLED display over spi (based on TEMPLATE 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...

## Detailed Description

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.

## Macro Definition Documentation

## ◆ CONTROLLER_NATIVE_SPI_BLOCK_8BIT_CMDS

#define CONTROLLER_NATIVE_SPI_BLOCK_8BIT_CMDS | ( |  | column_cmd,
|  |  | row_cmd
| ) |  |

Value:
static void set_block_native(lcduint_t x, lcduint_t y, lcduint_t w) \
{ \
uint8_t rx = w ? (x + w - 1) : (ssd1306_lcd.width - 1); \
ssd1306_intf.start(); \
ssd1306_spiDataMode(0); \
ssd1306_intf.send(column_cmd); \
ssd1306_intf.send(x); \
ssd1306_intf.send(rx < ssd1306_lcd.width ? rx : (ssd1306_lcd.width - 1)); \
ssd1306_intf.send(row_cmd); \
ssd1306_intf.send(y); \
ssd1306_intf.send(ssd1306_lcd.height - 1); \
ssd1306_spiDataMode(1); \
} \
static void next_page_native(void) \
{ \
} \
ssd1306_lcd
ssd1306_lcd_t ssd1306_lcd
Definition: lcd_common.c:33
ssd1306_lcd_t::height
lcduint_t height
Definition: lcd_common.h:97
ssd1306_lcd_t::width
lcduint_t width
Definition: lcd_common.h:94

Macro CONTROLLER_NATIVE_SPI_BLOCK_8BIT_CMDS() generates 2 static functions, applicable for many oled controllers with 8-bit commands: set_block_native(), next_page_native(). These functions are to be used when working in oled controller native mode.

Parameters

  column_cmd | command opcode for setting column address according to oled controller datasheet
  row_cmd | command opcode for setting row address according to oled controller datasheet

Note
  It is assumed that column and row commands accept 2 single byte arguments: start and end of region

Definition at line 366 of file lcd_common.h.

## ◆ g_lcd_type

#define g_lcd_type ssd1306_lcd.type

Current selected lcd display type

Deprecated:
  Use ssd1306_lcd.type instead.

Definition at line 188 of file lcd_common.h.

## ◆ s_displayHeight

#define s_displayHeight ssd1306_lcd.height

Current display height

Deprecated:
  Use ssd1306_lcd.height instead.

Definition at line 176 of file lcd_common.h.

## ◆ s_displayWidth

#define s_displayWidth ssd1306_lcd.width

Current display width

Deprecated:
  Use ssd1306_lcd.width instead.

Definition at line 182 of file lcd_common.h.

## ◆ SSD1306_COMPAT_SEND_PIXELS_RGB16_CMDS

#define SSD1306_COMPAT_SEND_PIXELS_RGB16_CMDS | ( |  | ) |

Value:
extern uint16_t ssd1306_color; \
static void send_pixels_compat16(uint8_t data) \
{ \
for (uint8_t i=8; i>0; i--) \
{ \
if ( data & 0x01 ) \
{ \
ssd1306_intf.send( (uint8_t)(ssd1306_color >> 8 ) ); \
ssd1306_intf.send( (uint8_t)(ssd1306_color & 0xFF) ); \
} \
else \
{ \
ssd1306_intf.send( 0B00000000 ); \
ssd1306_intf.send( 0B00000000 ); \
} \
data >>= 1; \
} \
} \
static void send_pixels_buffer_compat16(const uint8_t *buffer, uint16_t len) \
{ \
while(len--) \
{ \
send_pixels_compat16(*buffer); \
buffer++; \
} \
}

Macro SSD1306_COMPAT_SEND_PIXELS_RGB16_CMDS() generates 2 static functions, applicable for many oled controllers in 16-bit RGB mode: send_pixels_compat16(), send_pixels_buffer_compat16(). These functions are to be used when working in ssd1306 compatible mode.

Definition at line 422 of file lcd_common.h.

## ◆ SSD1306_COMPAT_SEND_PIXELS_RGB8_CMDS

#define SSD1306_COMPAT_SEND_PIXELS_RGB8_CMDS | ( |  | ) |

Value:
extern uint16_t ssd1306_color; \
static void send_pixels_compat(uint8_t data) \
{ \
for (uint8_t i=8; i>0; i--) \
{ \
if ( data & 0x01 ) \
{ \
ssd1306_intf.send( (uint8_t)ssd1306_color ); \
} \
else \
{ \
ssd1306_intf.send( 0B00000000 ); \
} \
data >>= 1; \
} \
} \
static void send_pixels_buffer_compat(const uint8_t *buffer, uint16_t len) \
{ \
while(len--) \
{ \
send_pixels_compat(*buffer); \
buffer++; \
} \
}

Macro SSD1306_COMPAT_SEND_PIXELS_RGB8_CMDS() generates 2 static functions, applicable for many oled controllers in 8-bit RGB mode: send_pixels_compat(), send_pixels_buffer_compat(). These functions are to be used when working in ssd1306 compatible mode.

Definition at line 390 of file lcd_common.h.

## ◆ SSD1306_COMPAT_SPI_BLOCK_8BIT_CMDS

#define SSD1306_COMPAT_SPI_BLOCK_8BIT_CMDS | ( |  | column_cmd,
|  |  | row_cmd
| ) |  |

Value:
static uint8_t __s_column; \
static uint8_t __s_page; \
static void set_block_compat(lcduint_t x, lcduint_t y, lcduint_t w) \
{ \
uint8_t rx = w ? (x + w - 1) : (ssd1306_lcd.width - 1); \
__s_column = x; \
__s_page = y; \
ssd1306_intf.start(); \
ssd1306_spiDataMode(0); \
ssd1306_intf.send(column_cmd); \
ssd1306_intf.send(x); \
ssd1306_intf.send(rx < ssd1306_lcd.width ? rx : (ssd1306_lcd.width - 1)); \
ssd1306_intf.send(row_cmd); \
ssd1306_intf.send(y<<3); \
ssd1306_intf.send(((y<<3) + 7) < ssd1306_lcd.height ? ((y<<3) + 7) : (ssd1306_lcd.height - 1)); \
ssd1306_spiDataMode(1); \
} \
static void next_page_compat(void) \
{ \
ssd1306_intf.stop(); \
set_block_compat(__s_column,__s_page+1,0); \
} \
ssd1306_lcd
ssd1306_lcd_t ssd1306_lcd
Definition: lcd_common.c:33
ssd1306_lcd_t::height
lcduint_t height
Definition: lcd_common.h:97
ssd1306_lcd_t::width
lcduint_t width
Definition: lcd_common.h:94

Macro SSD1306_COMPAT_SPI_BLOCK_8BIT_CMDS() generates 2 static functions, applicable for many oled controllers with 8-bit commands: set_block_compat(), next_page_compat(). These functions are to be used when working in ssd1306 compatible mode.

Parameters

  column_cmd | command opcode for setting column address according to oled controller datasheet
  row_cmd | command opcode for setting row address according to oled controller datasheet

Note
  It is assumed that column and row commands accept 2 single byte arguments: start and end of region

Definition at line 330 of file lcd_common.h.

## ◆ ssd1306_nextRamPage

#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.

Deprecated:
  Use ssd1306_lcd.next_page() instead.

Definition at line 224 of file lcd_common.h.

## ◆ ssd1306_sendPixel8

#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.

Parameters

  data | - byte, representing RGB8 pixel.

Deprecated:
  Use ssd1306_lcd.send_pixels8() instead.

Definition at line 247 of file lcd_common.h.

## ◆ ssd1306_sendPixels

#define ssd1306_sendPixels ssd1306_lcd.send_pixels1

Sends 8 monochrome vertical pixels to OLED driver.

Parameters

  data | - byte, representing 8 pixels.

Deprecated:
  Use ssd1306_lcd.send_pixels1() instead.

Definition at line 231 of file lcd_common.h.

## ◆ ssd1306_sendPixelsBuffer

#define ssd1306_sendPixelsBuffer ssd1306_lcd.send_pixels_buffer1

Sends buffer containing 8 monochrome vertical pixels, encoded in each byte.

Parameters

  buffer | - buffer containing monochrome pixels.
  len | - length of buffer in bytes.

Deprecated:
  Use ssd1306_lcd.send_pixels_buffer1() instead.

Definition at line 239 of file lcd_common.h.

## ◆ ssd1306_setRamBlock

#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.

Parameters

  x | - column (left region)
  y | - page (top page of the block)
  w | - width of the block in pixels to control

Deprecated:
  Use ssd1306_lcd.set_block() instead.

Warning
  - this function initiates session (i2c or spi) and do not close it. To close session, please, use ssd1306_intf.stop().

Definition at line 215 of file lcd_common.h.

## Enumeration Type Documentation

## ◆ lcd_mode_t

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.

Enumerator
LCD_MODE_NORMAL | Normal mode RGB displays. All ssd1306 monochrome direct draw functions do not work in this mode.
LCD_MODE_SSD1306_COMPAT | ssd1306 compatible mode. This is special mode, that allows to use ssd1306 monochrome direct draw functions, but RGB functions will not work.

Definition at line 69 of file lcd_common.h.

## ◆ lcd_type_t

enum lcd_type_t

Enumeration, describing display type

Enumerator
LCD_TYPE_SSD1306 | Default type of LCD display: ssd1306 oled
LCD_TYPE_PCD8544 | Experimental type of LCD display: pcd8544 led
LCD_TYPE_SH1106 | Support for sh1106 OLED display
LCD_TYPE_SSD1331 | Default type of LCD display: ssd1331 oled
LCD_TYPE_CUSTOM | User LCD type

Definition at line 50 of file lcd_common.h.

## Function Documentation

## ◆ composite_video_128x64_mono_init()

void composite_video_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.

See also
  ssd1306_uartInit_Builtin()
  ssd1306_vga_controller_init()

Definition at line 127 of file composite_video.c.

## ◆ il9163_128x128_init()

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.

See also
  ssd1306_i2cInit()
  ssd1306_spiInit()

Definition at line 253 of file lcd_il9163.c.

## ◆ il9163_128x128_spi_init()

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)

Parameters

  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 269 of file lcd_il9163.c.

## ◆ il9163_setMode()

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.

Parameters

  mode | 0 or 1

Deprecated:
  Use ssd1306_setMode() instead.

Definition at line 192 of file lcd_il9163.c.

## ◆ il9163_setOffset()

void il9163_setOffset | ( | lcdint_t | x,
|  | lcdint_t | y
| ) |  |

Sets screen offset (refer to datasheet of your display)

Set offset for the display

Parameters

  x | offset in pixels
  y | offset in pixels

Definition at line 176 of file lcd_il9163.c.

## ◆ ili9341_240x320_init()

void ili9341_240x320_init | ( | void |  | ) |

Inits 240x320 RGB OLED display (based on ili9341 controller).

Inits 240x320 RGB OLED display (based on ili9341 controller). User must init communication interface (i2c, spi) prior to calling this function.

See also
  ssd1306_i2cInit()
  ssd1306_spiInit()

Definition at line 196 of file lcd_ili9341.c.

## ◆ ili9341_240x320_spi_init()

void ili9341_240x320_spi_init | ( | int8_t | rstPin,
|  | int8_t | cesPin,
|  | int8_t | dcPin
| ) |  |

Inits 240x320 RGB TFT display over spi (based on ili9341 controller).

Inits 240x320 RGB TFT display over spi (based on ili9341 controller)

Parameters

  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 lcd_ili9341.c.

## ◆ ili9341_setMode()

void ili9341_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 ili9341_setMode(0) prior to using pure RGB methods.

Parameters

  mode | 0 or 1

Deprecated:
  Use ssd1306_setMode() instead.

Definition at line 139 of file lcd_ili9341.c.

## ◆ pcd8544_84x48_init()

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.

See also
  ssd1306_i2cInit()
  ssd1306_spiInit()

Definition at line 80 of file lcd_pcd8544.c.

## ◆ pcd8544_84x48_spi_init()

void pcd8544_84x48_spi_init | ( | int8_t | rstPin,
|  | int8_t | cesPin,
|  | int8_t | dcPin
| ) |  |

Inits 84x48 LED display over spi (based on PCD8544 controller)

Parameters

  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 100 of file lcd_pcd8544.c.

## ◆ sh1106_128x64_i2c_init()

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 113 of file oled_sh1106.c.

## ◆ sh1106_128x64_init()

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 97 of file oled_sh1106.c.

## ◆ sh1106_128x64_spi_init()

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)

Parameters

  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 119 of file oled_sh1106.c.

## ◆ ssd1306_128x32_i2c_init()

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 241 of file oled_ssd1306.c.

## ◆ ssd1306_128x32_init()

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.

See also
  ssd1306_i2cInit()
  ssd1306_spiInit()

Definition at line 225 of file oled_ssd1306.c.

## ◆ ssd1306_128x32_spi_init()

void ssd1306_128x32_spi_init | ( | int8_t | rstPin,
|  | int8_t | cesPin,
|  | int8_t | dcPin
| ) |  |

Inits 128x32 OLED display over spi (based on SSD1306 controller).

Inits 128x32 OLED display over spi (based on SSD1306 controller)

Parameters

  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 251 of file oled_ssd1306.c.

## ◆ ssd1306_128x64_i2c_init()

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 195 of file oled_ssd1306.c.

## ◆ ssd1306_128x64_i2c_initEx()

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.

Parameters

  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

Note
  scl and sda parameters depend on used hardware. For many hardware boards these parameters do not have any effect. ESP8266 allows to specify these parameters
  scl and sda for Linux systems should be the same, and should contain i2c bus id.

Definition at line 201 of file oled_ssd1306.c.

## ◆ ssd1306_128x64_init()

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.

See also
  ssd1306_i2cInit()
  ssd1306_spiInit()

Definition at line 179 of file oled_ssd1306.c.

## ◆ ssd1306_128x64_spi_init()

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)

Parameters

  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 211 of file oled_ssd1306.c.

## ◆ ssd1306_configureI2cDisplay()

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().

Parameters

  config | configuration, located in flash, to send to i2c/spi controller.
  configSize | - size of configuration data in bytes.

Definition at line 42 of file lcd_common.c.

## ◆ ssd1306_configureSpiDisplay()

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().

Parameters

  config | configuration, located in flash, to send to i2c/spi controller.
  configSize | - size of configuration data in bytes.

Definition at line 53 of file lcd_common.c.

## ◆ ssd1306_configureSpiDisplay2()

void ssd1306_configureSpiDisplay2 | ( | 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. Each command has additional parameter: number of arguments. If lcd controller requires cmd arguments to be sent in command mode, please use ssd1306_configureI2cDisplay().

Parameters

  config | configuration, located in flash, to send to i2c/spi controller.
  configSize | - size of configuration data in bytes.

Definition at line 75 of file lcd_common.c.

## ◆ ssd1306_displayHeight()

lcduint_t ssd1306_displayHeight | ( | void |  | ) |

Returns display height in pixels

Definition at line 58 of file ssd1306_generic.c.

## ◆ ssd1306_displayOff()

void ssd1306_displayOff | ( | void |  | ) |

Turns off display

Definition at line 119 of file oled_ssd1306.c.

## ◆ ssd1306_displayOn()

void ssd1306_displayOn | ( | void |  | ) |

Turns on display

Definition at line 125 of file oled_ssd1306.c.

## ◆ ssd1306_displayWidth()

lcduint_t ssd1306_displayWidth | ( | void |  | ) |

Returns display width in pixels

Definition at line 63 of file ssd1306_generic.c.

## ◆ ssd1306_flipHorizontal()

void ssd1306_flipHorizontal | ( | uint8_t | mode | ) |

performs horizontal flip

Performs horizontal flip. If you need to turn display by 180 degree, please use both ssd1306_flipHorizontal() and ssd1306_flipVertical().

Parameters

  mode | - 0 to disable horizontal flip 1 to enable horizontal flip

Definition at line 148 of file oled_ssd1306.c.

## ◆ ssd1306_flipVertical()

void ssd1306_flipVertical | ( | uint8_t | mode | ) |

performs vertical flip

Performs vertical flip. If you need to turn display by 180 degree, please use both ssd1306_flipHorizontal() and ssd1306_flipVertical().

Parameters

  mode | - 0 to disable vertical flip 1 to enable vertical flip

Definition at line 153 of file oled_ssd1306.c.

## ◆ ssd1306_getStartLine()

uint8_t ssd1306_getStartLine | ( | void |  | ) |

returns start line in gdram.

Definition at line 164 of file oled_ssd1306.c.

## ◆ ssd1306_init()

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().

Deprecated:
  Use ssd1306_128x64_i2c_init() instead.

Definition at line 173 of file oled_ssd1306.c.

## ◆ ssd1306_invertMode()

void ssd1306_invertMode | ( | void |  | ) |

Switches display to inverse mode. LCD will display 0-pixels as white, and 1-pixels as black.

Note
  Not supported for SSD1331

Definition at line 138 of file oled_ssd1306.c.

## ◆ ssd1306_normalMode()

void ssd1306_normalMode | ( | void |  | ) |

Switches display to normal mode.

Note
  Not supported for SSD1331

Definition at line 143 of file oled_ssd1306.c.

## ◆ ssd1306_resetController()

void ssd1306_resetController | ( | int8_t | rstPin,
|  | uint8_t | delayMs
| ) |  |

Does hardware reset for oled controller.

Does hardware reset for oled controller. The function pulls up rstPin for 10 milliseconds, then pulls down rstPin for delayMs milliseconds and then finally pulls rstPin up.

Parameters

  rstPin | reset pin number
  delayMs | delay in milliseconds to hold rstPin in low state

Definition at line 139 of file lcd_common.c.

## ◆ ssd1306_sendData()

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();

Parameters

  data | - byte to send to the controller memory

Note
  At present this function is used only in Arkanoid demo.

Deprecated:
  There is wide variaty of functions, that can be used for this.

Definition at line 35 of file lcd_common.c.

## ◆ ssd1306_setContrast()

void ssd1306_setContrast | ( | uint8_t | contrast | ) |

Set display contrast, ie light intensity

Parameters

  contrast | - contrast value to see, refer to ssd1306 datasheet

Definition at line 130 of file oled_ssd1306.c.

## ◆ ssd1306_setMode()

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.

Parameters

  mode | lcd mode to activate.

See also
  LCD_MODE_SSD1306_COMPAT
  LCD_MODE_NORMAL
  lcd_mode_t

Definition at line 131 of file lcd_common.c.

## ◆ ssd1306_setStartLine()

void ssd1306_setStartLine | ( | uint8_t | line | ) |

Sets start line in gdram to start display content with

Parameters

  line | start line in range 0 - 63

Definition at line 158 of file oled_ssd1306.c.

## ◆ ssd1325_128x64_init()

void ssd1325_128x64_init | ( | void |  | ) |

Inits 128x64 SSD1325 OLED display (based on SSD1325 controller).

Inits 128x64 SSD1325 OLED display (based on SSD1325 controller). User must init communication interface (i2c, spi) prior to calling this function.

See also
  ssd1306_i2cInit()
  ssd1306_spiInit()

Definition at line 154 of file oled_ssd1325.c.

## ◆ ssd1325_128x64_spi_init()

void ssd1325_128x64_spi_init | ( | int8_t | rstPin,
|  | int8_t | cesPin,
|  | int8_t | dcPin
| ) |  |

Inits 128x64 SSD1325 OLED display over spi (based on SSD1325 controller).

Inits 128x64 SSD1325 OLED display over spi (based on SSD1325 controller)

Parameters

  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 174 of file oled_ssd1325.c.

## ◆ ssd1325_setMode()

void ssd1325_setMode | ( | lcd_mode_t | mode | ) |

Sets GDRAM autoincrement mode.

Sets GDRAM autoincrement mode. By default, to make ssd1306_xxx functions compatible with SSD1325 oled display, SSD1325 oled is initialized in vertical auto-increment mode. But for pure SSD1325 oled operations horizontal auto-increment mode is more suitable. So, if you're going to use NanoCanvas8 functions, please call ssd1325_setMode(0) prior to using pure SSD1325 oled methods.

Parameters

  mode | 0 or 1

Deprecated:
  Use ssd1306_setMode() instead.

Definition at line 134 of file oled_ssd1325.c.

## ◆ ssd1327_128x128_init()

void ssd1327_128x128_init | ( | void |  | ) |

Inits 128x128 SSD1327 OLED display (based on SSD1327 controller).

Inits 128x128 SSD1327 OLED display (based on SSD1327 controller). User must init communication interface (i2c, spi) prior to calling this function.

See also
  ssd1306_i2cInit()
  ssd1306_spiInit()

Definition at line 166 of file oled_ssd1327.c.

## ◆ ssd1327_128x128_spi_init()

void ssd1327_128x128_spi_init | ( | int8_t | rstPin,
|  | int8_t | cesPin,
|  | int8_t | dcPin
| ) |  |

Inits 128x128 SSD1327 OLED display over spi (based on SSD1327 controller).

Inits 128x128 SSD1327 OLED display over spi (based on SSD1327 controller)

Parameters

  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 187 of file oled_ssd1327.c.

## ◆ ssd1331_96x64_init()

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.

See also
  ssd1306_i2cInit()
  ssd1306_spiInit()

Definition at line 201 of file oled_ssd1331.c.

## ◆ ssd1331_96x64_spi_init()

void ssd1331_96x64_spi_init | ( | int8_t | rstPin,
|  | int8_t | cesPin,
|  | int8_t | dcPin
| ) |  |

Inits 96x64 RGB OLED display over spi in 8-bit mode (based on SSD1331 controller).

Inits 96x64 RGB OLED display over spi in 8-bit mode (based on SSD1331 controller)

Parameters

  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 239 of file oled_ssd1331.c.

## ◆ ssd1331_96x64_spi_init16()

void ssd1331_96x64_spi_init16 | ( | int8_t | rstPin,
|  | int8_t | cesPin,
|  | int8_t | dcPin
| ) |  |

Inits 96x64 RGB OLED display over spi in 16-bit mode (based on SSD1331 controller).

Inits 96x64 RGB OLED display over spi in 16-bit mode (based on SSD1331 controller)

Parameters

  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 249 of file oled_ssd1331.c.

## ◆ ssd1331_copyBlock()

void ssd1331_copyBlock | ( | uint8_t | left,
|  | uint8_t | top,
|  | uint8_t | right,
|  | uint8_t | bottom,
|  | uint8_t | newLeft,
|  | uint8_t | newTop
| ) |  |

Copies block in GDRAM to new position

Parameters

  left | column start of block to copy
  top | row start of block to copy
  right | column end of block to copy
  bottom | row end of block to copy
  newLeft | new column start
  newTop | new row start

Note
  This API can be used only with ssd1331 RGB oled displays
  after copy command is sent, it takes some time from oled controller to complete operation. So, it is HIGHLY recommended to wait for reasonable time before send other graphics operations (for example, use 250us delay). This time is required for oled display to become ready to accept new commands.

Definition at line 274 of file oled_ssd1331.c.

## ◆ ssd1331_drawLine()

void ssd1331_drawLine | ( | uint8_t | x1,
|  | uint8_t | y1,
|  | uint8_t | x2,
|  | uint8_t | y2,
|  | uint16_t | color
| ) |  |

Draws line

Parameters

  x1 | - x position in pixels of start point
  y1 | - y position in pixels of start point
  x2 | - x position in pixels of end point
  y2 | - y position in pixels of end point
  color | - color of the line, refer to RGB_COLOR8 macros

Note
  This API can be used only with ssd1331 RGB oled displays

Definition at line 259 of file oled_ssd1331.c.

## ◆ ssd1331_setMode()

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.

Parameters

  mode | 0 or 1

Deprecated:
  Use ssd1306_setMode() instead.

Definition at line 112 of file oled_ssd1331.c.

## ◆ ssd1351_128x128_init()

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.

See also
  ssd1306_i2cInit()
  ssd1306_spiInit()

Definition at line 184 of file oled_ssd1351.c.

## ◆ ssd1351_128x128_spi_init()

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)

Parameters

  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 216 of file oled_ssd1351.c.

## ◆ ssd1351_setMode()

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.

Parameters

  mode | 0 or 1

Deprecated:
  Use ssd1306_setMode() instead.

Definition at line 124 of file oled_ssd1351.c.

## ◆ st7735_128x160_init()

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.

See also
  ssd1306_i2cInit()
  ssd1306_spiInit()

Definition at line 406 of file lcd_il9163.c.

## ◆ st7735_128x160_spi_init()

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)

Parameters

  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 422 of file lcd_il9163.c.

## ◆ template_setMode()

void template_setMode | ( | lcd_mode_t | mode | ) |

Sets GDRAM autoincrement mode.

Sets GDRAM autoincrement mode. By default, to make ssd1306_xxx functions compatible with TEMPLATE oled display, TEMPLATE oled is initialized in vertical auto-increment mode. But for pure TEMPLATE oled operations horizontal auto-increment mode is more suitable. So, if you're going to use NanoCanvas8 functions, please call template_setMode(0) prior to using pure TEMPLATE oled methods.

Parameters

  mode | 0 or 1

Deprecated:
  Use ssd1306_setMode() instead.

Definition at line 124 of file oled_template.c.

## ◆ template_WxH_init()

void template_WxH_init | ( | void |  | ) |

Inits WxH TEMPLATE OLED display (based on TEMPLATE controller).

Inits WxH TEMPLATE OLED display (based on TEMPLATE controller). User must init communication interface (i2c, spi) prior to calling this function.

See also
  ssd1306_i2cInit()
  ssd1306_spiInit()

Definition at line 144 of file oled_template.c.

## ◆ template_WxH_spi_init()

void template_WxH_spi_init | ( | int8_t | rstPin,
|  | int8_t | cesPin,
|  | int8_t | dcPin
| ) |  |

Inits WxH TEMPLATE OLED display over spi (based on TEMPLATE controller).

Inits WxH TEMPLATE OLED display over spi (based on TEMPLATE controller)

Parameters

  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 165 of file oled_template.c.

## ◆ vga_128x64_mono_init()

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.

See also
  ssd1306_uartInit_Builtin()
  ssd1306_vga_controller_init()

Definition at line 134 of file vga_monitor.c.

## ◆ vga_96x40_8colors_init()

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.

See also
  ssd1306_uartInit_Builtin()
  ssd1306_vga_controller_init()

Definition at line 121 of file vga_monitor.c.

## Variable Documentation

## ◆ ssd1306_lcd

ssd1306_lcd_t ssd1306_lcd

Structure containing callback to low level function for currently enabled display

Definition at line 33 of file lcd_common.c.