SSD1306 OLED display driver
1.8.2
This library is developed to control SSD1306/SSD1331/SSD1351/IL9163/PCD8554 RGB i2c/spi LED displays
|
#include <sprite_pool.h>
Public Member Functions | |
SpritePool () | |
void | drawSprites () |
void | refreshScreen () |
uint8_t | add (SPRITE &sprite) |
void | clear () |
void | remove (SPRITE &sprite) |
void | setRect (SSD1306_RECT rect) |
Static Public Attributes | |
static const uint8_t | SP_ERR_NO_SPACE = 0xFF |
No free space for new sprite error. | |
static const uint8_t | MAX_SPRITES = 10 |
Defines max sprites number supported by SpritePool. | |
Protected Member Functions | |
virtual void | drawBlock (uint8_t blockColumn, uint8_t blockRow) |
Protected Attributes | |
NanoCanvas | m_canvas |
Canvas used to draw sprites to avoid flickering. | |
SSD1306_RECT | m_rect |
Rectangle, which specifies part of the display, used by the sprites. | |
Sprites pool class automates processing of several sprites. It remembers pointers to SPRITE objects, and carefully updates only the areas, touched by the sprites. So, it reduces number of i2c calls to SSD1306 display.
Definition at line 42 of file sprite_pool.h.
SpritePool::SpritePool | ( | ) |
Creates empty SpritePool object. It is able to hold up to 10 sprites on AVR platforms and up to 32 sprites on ESP platforms.
uint8_t SpritePool::add | ( | SPRITE & | sprite | ) |
Adds SPRITE object to the internal list of SpritePool
sprite | - reference to SPRITE object |
void SpritePool::clear | ( | ) |
Removes all SPRITE objects from internal list of SpritePool.
|
protectedvirtual |
This method is call every time 8x8 pixels block is needed to be drawn. Use m_canvas field variable, which represents block to update. For example, you can draw any 8x8 image, starting at 0,0 position in m_canvas.
blockColumn | - column of the block to redraw |
blockRow | - row of the block to redraw |
void SpritePool::drawSprites | ( | ) |
Draw all areas, touched by the sprites. To remove flickering, the method uses NanoCanvas capabilities.
void SpritePool::refreshScreen | ( | ) |
Redraws whole area, used by the sprites.
void SpritePool::remove | ( | SPRITE & | sprite | ) |
Removes specific SPRITE object from the SpritePool.
|
inline |
Sets active paint area region in blocks (pixels / 8)
rect | - region in blocks (pixels / 8) |
Definition at line 96 of file sprite_pool.h.