SSD1306 OLED display driver
1.8.2
This library is developed to control SSD1306/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
|
#include <nano_gfx.h>
Public Member Functions | |
NanoCanvas (uint8_t w, uint8_t h, uint8_t *bytes) | |
void | drawPixel (uint8_t x, uint8_t y) __attribute__((deprecated)) |
void | putPixel (uint8_t x, uint8_t y) |
void | drawRect (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2) |
void | drawHLine (uint8_t x1, uint8_t y1, uint8_t x2) |
void | drawVLine (uint8_t x1, uint8_t y1, uint8_t y2) |
void | fillRect (uint8_t x1, uint8_t y1, uint8_t x2, uint8_t y2, uint8_t templ) |
void | clear () |
void | char_f6x8 (uint8_t x, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL) __attribute__((deprecated)) |
void | charF6x8 (uint8_t x, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL) |
void | charF12x16 (uint8_t x, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL) |
void | printFixed (uint8_t xpos, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL) |
void | printFixed2x (uint8_t xpos, uint8_t y, const char ch[], EFontStyle style=STYLE_NORMAL) |
void | drawSpritePgm (uint8_t x, uint8_t y, const uint8_t sprite[]) |
void | drawBitmap (uint8_t x, uint8_t y, uint8_t w, uint8_t h, const uint8_t *buf) |
void | drawSprite (uint8_t x, uint8_t y, const uint8_t sprite[]) |
void | drawSprite (SPRITE *sprite) |
uint8_t | width () const |
uint8_t | height () const |
uint8_t * | buffer () const |
void | invert () |
void | flipH () |
void | blt (uint8_t x, uint8_t y) |
NanoCanvas represents objects for drawing in memory buffer
Definition at line 39 of file nano_gfx.h.
|
inline |
Creates new canvas object. Width can be of any value. Height should be divided by 8. Memory buffer must be not less than w * h / 8.
w | - width |
h | - height |
bytes | - pointer to memory buffer to use |
Definition at line 52 of file nano_gfx.h.
void NanoCanvas::blt | ( | uint8_t | x, |
uint8_t | y | ||
) |
Draws canvas on the LCD display
x | - horizontal position in pixels |
y | - vertical position in blocks (pixels/8) |
|
inline |
Returns canvas buffer
Definition at line 210 of file nano_gfx.h.
|
inline |
Prints text to canvas buffer
x | - start position X |
y | - start position Y |
ch | - text to print (null-terminated) |
style | - font style (EFontStyle), normal by default |
Definition at line 126 of file nano_gfx.h.
void NanoCanvas::charF12x16 | ( | uint8_t | x, |
uint8_t | y, | ||
const char | ch[], | ||
EFontStyle | style = STYLE_NORMAL |
||
) |
Prints text to canvas buffer using double size font 12x16
x | - start position X |
y | - start position Y |
ch | - text to print (null-terminated) |
style | - font style (EFontStyle), normal by default |
void NanoCanvas::charF6x8 | ( | uint8_t | x, |
uint8_t | y, | ||
const char | ch[], | ||
EFontStyle | style = STYLE_NORMAL |
||
) |
Prints text to canvas buffer
x | - start position X |
y | - start position Y |
ch | - text to print (null-terminated) |
style | - font style (EFontStyle), normal by default |
void NanoCanvas::clear | ( | ) |
Clears canvas
void NanoCanvas::drawBitmap | ( | uint8_t | x, |
uint8_t | y, | ||
uint8_t | w, | ||
uint8_t | h, | ||
const uint8_t * | buf | ||
) |
Draw bitmap to the buffer from SRAM.
x | - horizontal position in pixels |
y | - vertical position in pixels |
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 NanoCanvas::drawHLine | ( | uint8_t | x1, |
uint8_t | y1, | ||
uint8_t | x2 | ||
) |
Draws horizontal line
x1 | - left boundary |
y1 | - position Y |
x2 | - right boundary |
|
inline |
Draws pixel on specified position
x | - position X |
y | - position Y |
Definition at line 69 of file nano_gfx.h.
void NanoCanvas::drawRect | ( | uint8_t | x1, |
uint8_t | y1, | ||
uint8_t | x2, | ||
uint8_t | y2 | ||
) |
Draws rectangle
x1 | - left boundary |
y1 | - top boundary |
x2 | - right boundary |
y2 | - bottom boundary |
void NanoCanvas::drawSprite | ( | uint8_t | x, |
uint8_t | y, | ||
const uint8_t | sprite[] | ||
) |
Sprite is small image 8x8, sprite doesn't change background Reads sprite from SRAM memory
void NanoCanvas::drawSprite | ( | SPRITE * | sprite | ) |
Draws sprite in the buffer
sprite | - pointer to SPRITE structure containing sprite information |
void NanoCanvas::drawSpritePgm | ( | uint8_t | x, |
uint8_t | y, | ||
const uint8_t | sprite[] | ||
) |
Sprite is small image 8x8, sprite doesn't change background Reads sprite from Flash memory
void NanoCanvas::drawVLine | ( | uint8_t | x1, |
uint8_t | y1, | ||
uint8_t | y2 | ||
) |
Draws vertical line
x1 | - position X |
y1 | - top boundary |
y2 | - bottom boundary |
void NanoCanvas::fillRect | ( | uint8_t | x1, |
uint8_t | y1, | ||
uint8_t | x2, | ||
uint8_t | y2, | ||
uint8_t | templ | ||
) |
Draws filled rectangle
x1 | - left boundary |
y1 | - top boundary |
x2 | - right boundary |
y2 | - bottom boundary |
templ | - template to use for filling rectangle |
void NanoCanvas::flipH | ( | ) |
Flips image horizontally.
|
inline |
Returns canvas height
Definition at line 205 of file nano_gfx.h.
void NanoCanvas::invert | ( | ) |
Inverts content in the buffer. white becomes black and wise versa.
void NanoCanvas::printFixed | ( | uint8_t | xpos, |
uint8_t | y, | ||
const char | ch[], | ||
EFontStyle | style = STYLE_NORMAL |
||
) |
Prints text to canvas buffer using fixed font.
xpos | - start position X |
y | - start position Y |
ch | - text to print (null-terminated) |
style | - font style (EFontStyle), normal by default |
void NanoCanvas::printFixed2x | ( | uint8_t | xpos, |
uint8_t | y, | ||
const char | ch[], | ||
EFontStyle | style = STYLE_NORMAL |
||
) |
Prints text to canvas buffer using fixed font double size.
xpos | - start position X |
y | - start position Y |
ch | - text to print (null-terminated) |
style | - font style (EFontStyle), normal by default |
void NanoCanvas::putPixel | ( | uint8_t | x, |
uint8_t | y | ||
) |
Draws pixel on specified position
x | - position X |
y | - position Y |
|
inline |
Returns canvas width
Definition at line 200 of file nano_gfx.h.