An I2C wrapper class for Ucglib.
UcglibI2C implements, with only minor restrictions, the full functionality of Ucglib by Oli Kraus, so that you can control any TFT or other display supported by Ucglib via I2C.
Limitations (also see README.md):
- Timing: Some Ucglib commands take so long that even the conservative default for I2Cdelay of 20 ms is not sufficient. They need extra delays or you'll run the risk of commands being dropped or even I2C bus lockup. Particularly watch out for begin() and clearScreen(), also for all commands changing a lot of pixels like large boxes, triangles etc. Start with extra delays of 200 ms and work down from that.
- Strings: drawString() and getStrWidth() commands are limited by I2CmaxBuf, which currently can only be directly modified in I2CWrapper.h, until a more flexible mechanism will be implemented. Due to overhead, max string length is (I2CmaxBuf - 10) = 10 characters for drawString() and (I2CmaxBuf - 6) = 14 characters for getStrWidth(). print() is not restricted, as it is inherited from the Arduino Print class.
- Fonts: Ucglib uses pointers to identify fonts. Here, we cannot transmit pointers to fonts for three reasons: (1) Addresses on the target will be different. (2) We do not want the controller to waste memory for fonts only the target will need. (3) The target might not have enough memory to make all Ucglib fonts available at all times.
That's why the target will have a preselected subset of fonts available and we only transmit the ID (of enum type UcglibI2C_Font) of that font here. ID's are nearly identical to the original font names, which are preceded with "I2C_", so that only minimal changes to any original code will be needed.
|
| UcglibI2C (I2Cwrapper *w) |
| Constructor. More...
|
|
void | begin (uint8_t is_transparent) |
|
void | clearScreen (void) |
|
void | setFont (UcglibI2C_Font id) |
|
void | setColor (uint8_t idx, uint8_t r, uint8_t g, uint8_t b) |
|
void | setColor (uint8_t r, uint8_t g, uint8_t b) |
|
void | setPrintPos (ucg_int_t x, ucg_int_t y) |
|
size_t | write (uint8_t c) |
|
void | undoRotate () |
|
void | setRotate90 () |
|
void | setRotate180 () |
|
void | setRotate270 () |
|
void | setFontRefHeightText () |
|
void | setFontRefHeightExtendedText () |
|
void | setFontRefHeightAll () |
|
void | setFontPosBaseline () |
|
void | setFontPosBottom () |
|
void | setFontPosTop () |
|
void | setFontPosCenter () |
|
void | undoScale () |
|
void | setScale2x2 () |
|
void | powerDown () |
|
void | powerUp () |
|
void | setMaxClipRange () |
|
void | undoClipRange () |
|
void | setPrintDir (uint8_t dir) |
|
void | setFontMode (uint8_t is_transparent) |
|
ucg_int_t | getWidth () |
|
ucg_int_t | getHeight () |
|
ucg_int_t | getFontAscent () |
|
ucg_int_t | getFontDescent () |
|
ucg_int_t | getStrWidth (const char *s) |
|
void | setClipRange (ucg_int_t x, ucg_int_t y, ucg_int_t w, ucg_int_t h) |
|
void | drawLine (ucg_int_t x1, ucg_int_t y1, ucg_int_t x2, ucg_int_t y2) |
|
void | drawBox (ucg_int_t x, ucg_int_t y, ucg_int_t w, ucg_int_t h) |
|
void | drawFrame (ucg_int_t x, ucg_int_t y, ucg_int_t w, ucg_int_t h) |
|
void | drawGradientLine (ucg_int_t x, ucg_int_t y, ucg_int_t len, ucg_int_t dir) |
|
void | drawGradientBox (ucg_int_t x, ucg_int_t y, ucg_int_t w, ucg_int_t h) |
|
void | drawPixel (ucg_int_t x, ucg_int_t y) |
|
void | drawHLine (ucg_int_t x, ucg_int_t y, ucg_int_t len) |
|
void | drawVLine (ucg_int_t x, ucg_int_t y, ucg_int_t len) |
|
void | drawRBox (ucg_int_t x, ucg_int_t y, ucg_int_t w, ucg_int_t h, ucg_int_t r) |
|
void | drawRFrame (ucg_int_t x, ucg_int_t y, ucg_int_t w, ucg_int_t h, ucg_int_t r) |
|
ucg_int_t | drawGlyph (ucg_int_t x, ucg_int_t y, uint8_t dir, uint8_t encoding) |
|
ucg_int_t | drawString (ucg_int_t x, ucg_int_t y, uint8_t dir, const char *str) |
|
void | drawDisc (ucg_int_t x0, ucg_int_t y0, ucg_int_t rad, uint8_t option) |
|
void | drawCircle (ucg_int_t x0, ucg_int_t y0, ucg_int_t rad, uint8_t option) |
|
void | drawTriangle (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2) |
|
void | drawTetragon (int16_t x0, int16_t y0, int16_t x1, int16_t y1, int16_t x2, int16_t y2, int16_t x3, int16_t y3) |
|