SSD1306 OLED display driver
1.4.6
This library is developed to control SSD1306/SSD1331 RGB i2c/spi OLED displays and spi PCD8544 LED display
|
Macros | |
#define | ssd1306_drawCanvas(x, y, w, h, buf) ssd1306_drawBuffer(x, y, w, h, buf) |
Functions | |
void | ssd1306_setPos (uint8_t x, uint8_t y) |
void | ssd1306_fillScreen (uint8_t fill_Data) |
void | ssd1306_clearScreen () |
void | ssd1306_negativeMode () |
void | ssd1306_positiveMode () |
uint8_t | ssd1306_printFixed (uint8_t xpos, uint8_t y, const char ch[], EFontStyle style) |
uint8_t | ssd1306_printFixed2x (uint8_t xpos, uint8_t y, const char ch[], EFontStyle style) __attribute__((deprecated)) |
uint8_t | ssd1306_printFixedN (uint8_t xpos, uint8_t y, const char ch[], EFontStyle style, uint8_t factor) |
uint8_t | ssd1306_charF6x8 (uint8_t x, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL) __attribute__((deprecated)) |
uint8_t | ssd1306_charF12x16 (uint8_t xpos, uint8_t y, const char ch[], EFontStyle style) __attribute__((deprecated)) |
uint8_t | ssd1306_charF6x8_eol (uint8_t left, uint8_t y, const char ch[], EFontStyle style, uint8_t right) __attribute__((deprecated)) |
void | ssd1306_setFixedFont (const uint8_t *progmemFont) |
void | ssd1306_setFont6x8 (const uint8_t *progmemFont) __attribute__((deprecated)) |
void | ssd1306_putPixel (uint8_t x, uint8_t y) |
void | ssd1306_putPixels (uint8_t x, uint8_t y, uint8_t pixels) |
void | ssd1306_drawRect (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2) |
void | ssd1306_drawLine (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2) |
void | ssd1306_drawHLine (uint8_t x1, uint8_t y1, uint8_t x2) |
void | ssd1306_drawVLine (uint8_t x1, uint8_t y1, uint8_t y2) |
void | ssd1306_drawBuffer (uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *buf) |
void | ssd1306_drawBitmap (uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *buf) |
void | ssd1306_clearBlock (uint8_t x, uint8_t y, uint8_t w, uint8_t h) |
void | ssd1306_drawSpriteEx (uint8_t x, uint8_t y, uint8_t w, const uint8_t *sprite) |
void | ssd1306_drawSprite (SPRITE *sprite) |
void | ssd1306_eraseSprite (SPRITE *sprite) |
void | ssd1306_eraseTrace (SPRITE *sprite) |
SPRITE | ssd1306_createSprite (uint8_t x, uint8_t y, uint8_t w, const uint8_t *data) |
void | ssd1306_replaceSprite (SPRITE *sprite, const uint8_t *data) |
#define ssd1306_drawCanvas | ( | x, | |
y, | |||
w, | |||
h, | |||
buf | |||
) | ssd1306_drawBuffer(x, y, w, h, buf) |
Draws bitmap, located in SRAM, on the display Each byte represents 8 vertical pixels.
x | - horizontal position in pixels |
y | - vertical position in blocks (pixels/8) |
w | - width of bitmap in pixels |
h | - height of bitmap in pixels (must be divided by 8) |
buf | - pointer to data, located in SRAM: each byte represents 8 vertical pixels. |
uint8_t ssd1306_charF12x16 | ( | uint8_t | xpos, |
uint8_t | y, | ||
const char | ch[], | ||
EFontStyle | style | ||
) |
uint8_t ssd1306_charF6x8 | ( | uint8_t | x, |
uint8_t | y, | ||
const char | ch[], | ||
EFontStyle | style = STYLE_NORMAL |
||
) |
uint8_t ssd1306_charF6x8_eol | ( | uint8_t | left, |
uint8_t | y, | ||
const char | ch[], | ||
EFontStyle | style, | ||
uint8_t | right | ||
) |
Prints text to screen using set font. If real text ends before right boundary, the remaining part on the display will be erased till right boundary.
left | - horizontal position in pixels |
y | - vertical position in blocks (pixels/8) |
ch | - NULL-terminated string to print |
style | - font style (EFontStyle), normal by default. |
right | - right boundary of the text to output |
void ssd1306_clearBlock | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | w, | ||
uint8_t | h | ||
) |
Fills block with black pixels
x | - horizontal position in pixels |
y | - vertical position in blocks (pixels/8) |
w | - width of block in pixels |
h | - height of block in pixels (must be divided by 8) |
SPRITE ssd1306_createSprite | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | w, | ||
const uint8_t * | data | ||
) |
Creates sprite object. Sprite height is fixed to 8 pixels
x | - horizontal position in pixels |
y | - vertical position in pixels |
w | - width of sprite in pixels |
data | - pointer to data, located in Flash: each byte represents 8 vertical pixels. |
void ssd1306_drawBitmap | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | w, | ||
uint8_t | h, | ||
const uint8_t * | buf | ||
) |
Draws bitmap, located in Flash, on the display
x | - horizontal position in pixels |
y | - vertical position in blocks (pixels/8) |
w | - width of bitmap in pixels |
h | - height of bitmap in pixels (must be divided by 8) |
buf | - pointer to data, located in Flash: each byte represents 8 vertical pixels. |
void ssd1306_drawBuffer | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | w, | ||
uint8_t | h, | ||
const uint8_t * | buf | ||
) |
Draws bitmap, located in SRAM, on the display Each byte represents 8 vertical pixels.
x | - horizontal position in pixels |
y | - vertical position in blocks (pixels/8) |
w | - width of bitmap in pixels |
h | - height of bitmap in pixels (must be divided by 8) |
buf | - pointer to data, located in SRAM: each byte represents 8 vertical pixels. |
void ssd1306_drawHLine | ( | uint8_t | x1, |
uint8_t | y1, | ||
uint8_t | x2 | ||
) |
void ssd1306_drawLine | ( | uint8_t | x1, |
uint8_t | y1, | ||
uint8_t | x2, | ||
uint8_t | y2 | ||
) |
Draws line
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 |
void ssd1306_drawRect | ( | uint8_t | x1, |
uint8_t | y1, | ||
uint8_t | x2, | ||
uint8_t | y2 | ||
) |
void ssd1306_drawSprite | ( | SPRITE * | sprite | ) |
void ssd1306_drawSpriteEx | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | w, | ||
const uint8_t * | sprite | ||
) |
Draws bitmap, located in Flash, on the display. This sprite must have wx8 size
x | - horizontal position in pixels |
y | - vertical position in blocks (pixels/8) |
w | - width in pixels |
sprite | - pointer to data, located in Flash: each byte represents 8 vertical pixels. |
void ssd1306_drawVLine | ( | uint8_t | x1, |
uint8_t | y1, | ||
uint8_t | y2 | ||
) |
void ssd1306_eraseSprite | ( | SPRITE * | sprite | ) |
void ssd1306_eraseTrace | ( | SPRITE * | sprite | ) |
void ssd1306_fillScreen | ( | uint8_t | fill_Data | ) |
void ssd1306_negativeMode | ( | ) |
void ssd1306_positiveMode | ( | ) |
uint8_t ssd1306_printFixed | ( | uint8_t | xpos, |
uint8_t | y, | ||
const char | ch[], | ||
EFontStyle | style | ||
) |
Prints text to screen using fixed font.
xpos | - horizontal position in pixels |
y | - vertical position in pixels |
ch | - NULL-terminated string to print |
style | - font style (EFontStyle), normal by default. |
uint8_t ssd1306_printFixed2x | ( | uint8_t | xpos, |
uint8_t | y, | ||
const char | ch[], | ||
EFontStyle | style | ||
) |
Prints text to screen using double size fixed font.
xpos | - horizontal position in pixels |
y | - vertical position in pixels |
ch | - NULL-terminated string to print |
style | - font style (EFontStyle), normal by default. |
uint8_t ssd1306_printFixedN | ( | uint8_t | xpos, |
uint8_t | y, | ||
const char | ch[], | ||
EFontStyle | style, | ||
uint8_t | factor | ||
) |
Prints text to screen using size fixed font, scaled by factor value.
Factor value 0 gives regular font size (6x8 for example)
Factor value 1 gives double font size (12x16 if 6x8 font is used)
Factor value 2 gives fourth font size (24x32 if 6x8 font is used)
Factor value 3 gives eighth font size (48x64 if 6x8 font is used)
xpos | - horizontal position in pixels |
y | - vertical position in pixels |
ch | - NULL-terminated string to print |
style | - font style (EFontStyle), normal by default. |
factor | - 0, 1, 2, 3. |
void ssd1306_putPixel | ( | uint8_t | x, |
uint8_t | y | ||
) |
Put single pixel on the LCD.
x | - horizontal position in pixels |
y | - vertical position in pixels |
void ssd1306_putPixels | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | pixels | ||
) |
Puts eight vertical pixels on the LCD at once.
x | - horizontal position in pixels |
y | - vertical position pixels. Should be multiply of 8. |
pixels | - bit-pixels to draw on display |
void ssd1306_replaceSprite | ( | SPRITE * | sprite, |
const uint8_t * | data | ||
) |
void ssd1306_setFixedFont | ( | const uint8_t * | progmemFont | ) |
Function allows to set another fixed font for the library. By default, the font supports only first 128 - 32 ascii chars. First 32 chars of ascii table are non-printable, and removed from the font table to reduce flash memory consumption. Default font doesn't support russian characters. Using this function you can implement your own fonts. First font char must be started with <space> image. Font data should be in the following format: | 0x00 | 0xWW | 0xHH | 0xAA | FONT DATA |, where 0xWW - width in pixels, 0xHH - height in pixels, 0xAA - ascii offset (0x20).
For fixed font 6x8 each char is presented by 6 bytes:
COL0, COL1, COL2, COL3, COL4, COL5.
For fixed font 4x16 each char is presented by 4x16/8 = 8 bytes:
ROW0: COL0, COL1, COL2, COL3,
ROW1: COL0, COL1, COL2, COL3
progmemFont | - font to setup located in Flash area |
void ssd1306_setFont6x8 | ( | const uint8_t * | progmemFont | ) |
Function allows to set another font for the library. By default, the font supports only first 128 - 32 ascii chars. First 32 chars of ascii table are non-printable, and removed from the font table to reduce flash memory consumption. Default font doesn't support russian characters. Using this function you can implement your own fonts. First font char must be started with <space> image.
progmemFont | - font to setup located in Flash area |
void ssd1306_setPos | ( | uint8_t | x, |
uint8_t | y | ||
) |
Set position in terms of display.
x | - horizontal position in pixels |
y | - vertical position in blocks (pixels/8) |