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

Functions
DIRECT DRAW: 8-bit API functions only for color displays

LCD direct draw functions only for color display. More...

## Functions
void | ssd1306_setColor (uint16_t color)
| Sets default color, generated by RGB_COLOR8 or RGB_COLOR16 macros. More...
void | ssd1306_setRgbColor (uint8_t r, uint8_t g, uint8_t b)
| Sets default color. More...
void | ssd1306_setRgbColor8 (uint8_t r, uint8_t g, uint8_t b)
| Sets default color. More...
void | ssd1306_drawMonoBuffer8 (lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
void | ssd1306_drawBufferFast8 (lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, const uint8_t *data)
void | ssd1306_drawBufferEx8 (lcdint_t x, lcdint_t y, lcduint_t w, lcduint_t h, lcduint_t pitch, const uint8_t *data)
void | ssd1306_fillScreen8 (uint8_t fill_Data)
void | ssd1306_clearScreen8 (void)
void | ssd1306_putPixel8 (lcdint_t x, lcdint_t y)
void | ssd1306_putColorPixel8 (lcdint_t x, lcdint_t y, uint8_t color)
void | ssd1306_drawVLine8 (lcdint_t x1, lcdint_t y1, lcdint_t y2)
void | ssd1306_drawHLine8 (lcdint_t x1, lcdint_t y1, lcdint_t x2)
void | ssd1306_drawLine8 (lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
void | ssd1306_drawRect8 (lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
void | ssd1306_fillRect8 (lcdint_t x1, lcdint_t y1, lcdint_t x2, lcdint_t y2)
void | ssd1306_drawMonoBitmap8 (lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
void | ssd1306_drawBitmap8 (lcdint_t xpos, lcdint_t ypos, lcduint_t w, lcduint_t h, const uint8_t *bitmap)
void | ssd1306_clearBlock8 (uint8_t x, uint8_t y, uint8_t w, uint8_t h)
void | ssd1306_setCursor8 (lcduint_t x, lcduint_t y)
void | ssd1306_printChar8 (uint8_t c)
size_t | ssd1306_write8 (uint8_t ch)
| Prints single character to display at current cursor position. More...
size_t | ssd1306_print8 (const char ch[])
| Prints null-terminated string to display at current cursor position. More...
uint8_t | ssd1306_printFixed8 (lcdint_t x, lcdint_t y, const char *ch, EFontStyle style)

## Detailed Description

LCD direct draw functions only for color display.

LCD direct draw functions are applicable for color display types. These functions will NOT work in ssd1306 compatible mode. Use ssd1306_setMode() function to change display mode to NORMAL. You can combine combine NanoEngine capabilities with these functions. Direct draw functions draw directly in GDRAM and do not use any double-buffering.

## Function Documentation

## ◆ ssd1306_clearBlock8()

void ssd1306_clearBlock8 | ( | uint8_t | x,
|  | uint8_t | y,
|  | uint8_t | w,
|  | uint8_t | h
| ) |  |

Clears block, filling it with black pixels, directly in OLED display GDRAM.

Parameters

  x | start horizontal position in pixels
  y | start vertical position in pixels
  w | block width in pixels
  h | block height in pixels

Definition at line 281 of file ssd1306_8bit.c.

## ◆ ssd1306_clearScreen8()

void ssd1306_clearScreen8 | ( | void |  | ) |

Fills screen with zero-byte

Definition at line 127 of file ssd1306_8bit.c.

## ◆ ssd1306_drawBitmap8()

void ssd1306_drawBitmap8 | ( | lcdint_t | xpos,
|  | lcdint_t | ypos,
|  | lcduint_t | w,
|  | lcduint_t | h,
|  | const uint8_t * | bitmap
| ) |  |

Draw 8-bit color bitmap, located in Flash, directly to OLED display GDRAM. Each pixel of the bitmap is expected in 3-3-2 format.

Parameters

  xpos | start horizontal position in pixels
  ypos | start vertical position in pixels
  w | bitmap width in pixels
  h | bitmap height in pixels
  bitmap | pointer to Flash data, containing 8-bit color bitmap.

Definition at line 269 of file ssd1306_8bit.c.

## ◆ ssd1306_drawBufferEx8()

void ssd1306_drawBufferEx8 | ( | lcdint_t | x,
|  | lcdint_t | y,
|  | lcduint_t | w,
|  | lcduint_t | h,
|  | lcduint_t | pitch,
|  | const uint8_t * | data
| ) |  |

Draws 8-bit bitmap, located in SRAM, on the display, taking into account pitch parameter. Each byte represents separate pixel: refer to RGB_COLOR8 to understand RGB scheme, being used. pitch parameter specifies, length of single line in bytes.

Parameters

  x | - horizontal position in pixels
  y | - vertical position in pixels
  w | - width of bitmap in pixels
  h | - height of bitmap in pixels
  pitch | length of bitmap buffer line in bytes
  data | - pointer to data, located in SRAM.

Definition at line 111 of file ssd1306_8bit.c.

## ◆ ssd1306_drawBufferFast8()

void ssd1306_drawBufferFast8 | ( | lcdint_t | x,
|  | lcdint_t | y,
|  | lcduint_t | w,
|  | lcduint_t | h,
|  | const uint8_t * | data
| ) |  |

Draws 8-bit bitmap, located in SRAM, on the display Each byte represents separate pixel: refer to RGB_COLOR8 to understand RGB scheme, being used.

Parameters

  x | - horizontal position in pixels
  y | - vertical position in pixels
  w | - width of bitmap in pixels
  h | - height of bitmap in pixels
  data | - pointer to data, located in SRAM.

Definition at line 106 of file ssd1306_8bit.c.

## ◆ ssd1306_drawHLine8()

void ssd1306_drawHLine8 | ( | lcdint_t | x1,
|  | lcdint_t | y1,
|  | lcdint_t | x2
| ) |  |

Draw horizontal line directly in OLED display GDRAM.

Parameters

  x1 | - left position in pixels
  y1 | - vertical vertical position in pixels
  x2 | - right position in pixels

Note
  set color with ssd1306_setColor() function.

Definition at line 157 of file ssd1306_8bit.c.

## ◆ ssd1306_drawLine8()

void ssd1306_drawLine8 | ( | lcdint_t | x1,
|  | lcdint_t | y1,
|  | lcdint_t | x2,
|  | lcdint_t | y2
| ) |  |

Draw line directly in OLED display GDRAM. This is software implementation. Some OLED controllers have hardware implementation. Refer to datasheet.

Parameters

  x1 | - start horizontal position in pixels
  y1 | - start vertical position in pixels
  x2 | - end horizontal position in pixels
  y2 | - end vertical position in pixels

Note
  set color with ssd1306_setColor() function.

Definition at line 168 of file ssd1306_8bit.c.

## ◆ ssd1306_drawMonoBitmap8()

void ssd1306_drawMonoBitmap8 | ( | lcdint_t | xpos,
|  | lcdint_t | ypos,
|  | lcduint_t | w,
|  | lcduint_t | h,
|  | const uint8_t * | bitmap
| ) |  |

Draw monochrome bitmap, located in Flash, directly to OLED display GDRAM. The bitmap should be in ssd1306 format (each byte represents 8 vertical pixels)

Parameters

  xpos | start horizontal position in pixels
  ypos | start vertical position in pixels
  w | bitmap width in pixels
  h | bitmap height in pixels
  bitmap | pointer to Flash data, containing monochrome bitmap.

Note
  set color with ssd1306_setColor() function.

Definition at line 238 of file ssd1306_8bit.c.

## ◆ ssd1306_drawMonoBuffer8()

void ssd1306_drawMonoBuffer8 | ( | lcdint_t | xpos,
|  | lcdint_t | ypos,
|  | lcduint_t | w,
|  | lcduint_t | h,
|  | const uint8_t * | bitmap
| ) |  |

Draws 1-bit bitmap, located in SRAM, on the display Each bit represents separate pixel: refer to ssd1306 datasheet for more information.

Parameters

  xpos | horizontal position in pixels
  ypos | vertical position in pixels
  w | width of bitmap in pixels
  h | height of bitmap in pixels
  bitmap | pointer to data, located in SRAM.

Definition at line 59 of file ssd1306_8bit.c.

## ◆ ssd1306_drawRect8()

void ssd1306_drawRect8 | ( | lcdint_t | x1,
|  | lcdint_t | y1,
|  | lcdint_t | x2,
|  | lcdint_t | y2
| ) |  |

Draw rectangle directly in OLED display GDRAM. This is software implementation. Some OLED controllers have hardware implementation. Refer to datasheet.

Parameters

  x1 | - start horizontal position in pixels
  y1 | - start vertical position in pixels
  x2 | - end horizontal position in pixels
  y2 | - end vertical position in pixels

Note
  set color with ssd1306_setColor() function.

Definition at line 211 of file ssd1306_8bit.c.

## ◆ ssd1306_drawVLine8()

void ssd1306_drawVLine8 | ( | lcdint_t | x1,
|  | lcdint_t | y1,
|  | lcdint_t | y2
| ) |  |

Draw vertical line directly in OLED display GDRAM.

Parameters

  x1 | - horizontal position in pixels
  y1 | - top vertical position in pixels
  y2 | - bottom vertical position in pixels

Note
  set color with ssd1306_setColor() function.

Definition at line 146 of file ssd1306_8bit.c.

## ◆ ssd1306_fillRect8()

void ssd1306_fillRect8 | ( | lcdint_t | x1,
|  | lcdint_t | y1,
|  | lcdint_t | x2,
|  | lcdint_t | y2
| ) |  |

Fill rectangle directly in OLED display GDRAM. This is software implementation. Some OLED controllers have hardware implementation. Refer to datasheet.

Parameters

  x1 | - start horizontal position in pixels
  y1 | - start vertical position in pixels
  x2 | - end horizontal position in pixels
  y2 | - end vertical position in pixels

Note
  set color with ssd1306_setColor() function.

Definition at line 219 of file ssd1306_8bit.c.

## ◆ ssd1306_fillScreen8()

void ssd1306_fillScreen8 | ( | uint8_t | fill_Data | ) |

Fills screen with pattern byte

Parameters

  fill_Data | pattern color to fill screen with

Definition at line 116 of file ssd1306_8bit.c.

## ◆ ssd1306_print8()

size_t ssd1306_print8 | ( | const char | ch[] | ) |

Prints null-terminated string to display at current cursor position.

Prints null-terminated string to display at current cursor position Cursor position can be set by ssd1306_setCursor8().

Parameters

  ch | - string to print to the display. 'LF' and 'CR' are skipped

Returns
  returns number of printed characters.

Definition at line 360 of file ssd1306_8bit.c.

## ◆ ssd1306_printChar8()

void ssd1306_printChar8 | ( | uint8_t | c | ) |

Draws single character to canvas. Cursor position is defined by ssd1306_setCursor8(). Do not changes cursor position

Parameters

  c | - character code to print

Note
  set color with ssd1306_setColor() function.

Definition at line 298 of file ssd1306_8bit.c.

## ◆ ssd1306_printFixed8()

uint8_t ssd1306_printFixed8 | ( | lcdint_t | x,
|  | lcdint_t | y,
|  | const char * | ch,
|  | EFontStyle | style
| ) |  |

Prints text to screen using fixed font.

Parameters

  x | horizontal position in pixels
  y | vertical position in pixels
  ch | NULL-terminated string to print
  style | font style (EFontStyle), normal by default (not implemented).

Returns
  number of chars in string

See also
  ssd1306_setFixedFont

Note
  set color with ssd1306_setColor() function.

Definition at line 371 of file ssd1306_8bit.c.

## ◆ ssd1306_putColorPixel8()

void ssd1306_putColorPixel8 | ( | lcdint_t | x,
|  | lcdint_t | y,
|  | uint8_t | color
| ) |  |

Puts single color point directly in OLED display GDRAM.

Parameters

  x | - horizontal position in pixels
  y | - vertical position in pixels
  color | color in RGB8 format (2-3-2)

Definition at line 139 of file ssd1306_8bit.c.

## ◆ ssd1306_putPixel8()

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

Puts single color point directly in OLED display GDRAM.

Parameters

  x | - horizontal position in pixels
  y | - vertical position in pixels

Note
  set color with ssd1306_setColor() function.

Definition at line 132 of file ssd1306_8bit.c.

## ◆ ssd1306_setColor()

void ssd1306_setColor | ( | uint16_t | color | ) |

Sets default color, generated by RGB_COLOR8 or RGB_COLOR16 macros.

Sets color generated by RGB_COLOR8 or RGB_COLOR16 macros.

Parameters

  color | - new color to use for monochrome-specific operations on color display.

Definition at line 44 of file ssd1306_8bit.c.

## ◆ ssd1306_setCursor8()

void ssd1306_setCursor8 | ( | lcduint_t | x,
|  | lcduint_t | y
| ) |  |

Set cursor position for text functions

Parameters

  x | horizontal position in pixels.
  y | vertical position in pixels.

Definition at line 292 of file ssd1306_8bit.c.

## ◆ ssd1306_setRgbColor()

void ssd1306_setRgbColor | ( | uint8_t | r,
|  | uint8_t | g,
|  | uint8_t | b
| ) |  |

Sets default color.

Sets default color for monochrome operations. For now this function supports only 8-bit RGB mode. To work with RGB colors in 16-bit mode, please refer to ssd1306_setColor() function and RGB_COLOR16 macros.

Parameters

  r | - red in 0-255 range.
  g | - green in 0-255 range.
  b | - blue in 0-255 range.

Definition at line 49 of file ssd1306_8bit.c.

## ◆ ssd1306_setRgbColor8()

void ssd1306_setRgbColor8 | ( | uint8_t | r,
|  | uint8_t | g,
|  | uint8_t | b
| ) |  |

Sets default color.

Sets default color for monochrome operations. For now this function supports only 8-bit RGB mode. To work with RGB colors in 16-bit mode, please refer to ssd1306_setColor() function and RGB_COLOR16 macros.

Parameters

  r | - red in 0-255 range.
  g | - green in 0-255 range.
  b | - blue in 0-255 range.

Definition at line 54 of file ssd1306_8bit.c.

## ◆ ssd1306_write8()

size_t ssd1306_write8 | ( | uint8_t | ch | ) |

Prints single character to display at current cursor position.

Prints single character to display at current cursor position. Cursor position can be set by ssd1306_setCursor8().

Parameters

  ch | - character to print to the display. 'LF' and 'CR' are skipped

Returns
  returns number of printed characters.

Definition at line 311 of file ssd1306_8bit.c.