I2Cwrapper v0.5.0
Generic framework for Arduino I2C target devices
UcglibI2C Class Reference

An I2C wrapper class for Ucglib. More...

Detailed Description

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.

Public Member Functions

 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)
 

Constructor & Destructor Documentation

◆ UcglibI2C()

UcglibI2C::UcglibI2C ( I2Cwrapper w)

Constructor.

Parameters
wWrapper object representing the target the TFT/Ucglib display is connected to.

Member Function Documentation

◆ begin()

void UcglibI2C::begin ( uint8_t  is_transparent)

◆ clearScreen()

void UcglibI2C::clearScreen ( void  )

◆ drawBox()

void UcglibI2C::drawBox ( ucg_int_t  x,
ucg_int_t  y,
ucg_int_t  w,
ucg_int_t  h 
)

◆ drawCircle()

void UcglibI2C::drawCircle ( ucg_int_t  x0,
ucg_int_t  y0,
ucg_int_t  rad,
uint8_t  option 
)

◆ drawDisc()

void UcglibI2C::drawDisc ( ucg_int_t  x0,
ucg_int_t  y0,
ucg_int_t  rad,
uint8_t  option 
)

◆ drawFrame()

void UcglibI2C::drawFrame ( ucg_int_t  x,
ucg_int_t  y,
ucg_int_t  w,
ucg_int_t  h 
)

◆ drawGlyph()

ucg_int_t UcglibI2C::drawGlyph ( ucg_int_t  x,
ucg_int_t  y,
uint8_t  dir,
uint8_t  encoding 
)

◆ drawGradientBox()

void UcglibI2C::drawGradientBox ( ucg_int_t  x,
ucg_int_t  y,
ucg_int_t  w,
ucg_int_t  h 
)

◆ drawGradientLine()

void UcglibI2C::drawGradientLine ( ucg_int_t  x,
ucg_int_t  y,
ucg_int_t  len,
ucg_int_t  dir 
)

◆ drawHLine()

void UcglibI2C::drawHLine ( ucg_int_t  x,
ucg_int_t  y,
ucg_int_t  len 
)

◆ drawLine()

void UcglibI2C::drawLine ( ucg_int_t  x1,
ucg_int_t  y1,
ucg_int_t  x2,
ucg_int_t  y2 
)

◆ drawPixel()

void UcglibI2C::drawPixel ( ucg_int_t  x,
ucg_int_t  y 
)

◆ drawRBox()

void UcglibI2C::drawRBox ( ucg_int_t  x,
ucg_int_t  y,
ucg_int_t  w,
ucg_int_t  h,
ucg_int_t  r 
)

◆ drawRFrame()

void UcglibI2C::drawRFrame ( ucg_int_t  x,
ucg_int_t  y,
ucg_int_t  w,
ucg_int_t  h,
ucg_int_t  r 
)

◆ drawString()

ucg_int_t UcglibI2C::drawString ( ucg_int_t  x,
ucg_int_t  y,
uint8_t  dir,
const char *  str 
)

◆ drawTetragon()

void UcglibI2C::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 
)

◆ drawTriangle()

void UcglibI2C::drawTriangle ( int16_t  x0,
int16_t  y0,
int16_t  x1,
int16_t  y1,
int16_t  x2,
int16_t  y2 
)

◆ drawVLine()

void UcglibI2C::drawVLine ( ucg_int_t  x,
ucg_int_t  y,
ucg_int_t  len 
)

◆ getFontAscent()

ucg_int_t UcglibI2C::getFontAscent ( )

◆ getFontDescent()

ucg_int_t UcglibI2C::getFontDescent ( )

◆ getHeight()

ucg_int_t UcglibI2C::getHeight ( )

◆ getStrWidth()

ucg_int_t UcglibI2C::getStrWidth ( const char *  s)

◆ getWidth()

ucg_int_t UcglibI2C::getWidth ( )

◆ powerDown()

void UcglibI2C::powerDown ( )

◆ powerUp()

void UcglibI2C::powerUp ( )

◆ setClipRange()

void UcglibI2C::setClipRange ( ucg_int_t  x,
ucg_int_t  y,
ucg_int_t  w,
ucg_int_t  h 
)

◆ setColor() [1/2]

void UcglibI2C::setColor ( uint8_t  idx,
uint8_t  r,
uint8_t  g,
uint8_t  b 
)

◆ setColor() [2/2]

void UcglibI2C::setColor ( uint8_t  r,
uint8_t  g,
uint8_t  b 
)

◆ setFont()

void UcglibI2C::setFont ( UcglibI2C_Font  id)

◆ setFontMode()

void UcglibI2C::setFontMode ( uint8_t  is_transparent)

◆ setFontPosBaseline()

void UcglibI2C::setFontPosBaseline ( )

◆ setFontPosBottom()

void UcglibI2C::setFontPosBottom ( )

◆ setFontPosCenter()

void UcglibI2C::setFontPosCenter ( )

◆ setFontPosTop()

void UcglibI2C::setFontPosTop ( )

◆ setFontRefHeightAll()

void UcglibI2C::setFontRefHeightAll ( )

◆ setFontRefHeightExtendedText()

void UcglibI2C::setFontRefHeightExtendedText ( )

◆ setFontRefHeightText()

void UcglibI2C::setFontRefHeightText ( )

◆ setMaxClipRange()

void UcglibI2C::setMaxClipRange ( )

◆ setPrintDir()

void UcglibI2C::setPrintDir ( uint8_t  dir)

◆ setPrintPos()

void UcglibI2C::setPrintPos ( ucg_int_t  x,
ucg_int_t  y 
)

◆ setRotate180()

void UcglibI2C::setRotate180 ( )

◆ setRotate270()

void UcglibI2C::setRotate270 ( )

◆ setRotate90()

void UcglibI2C::setRotate90 ( )

◆ setScale2x2()

void UcglibI2C::setScale2x2 ( )

◆ undoClipRange()

void UcglibI2C::undoClipRange ( )

◆ undoRotate()

void UcglibI2C::undoRotate ( )

◆ undoScale()

void UcglibI2C::undoScale ( )

◆ write()

size_t UcglibI2C::write ( uint8_t  c)

The documentation for this class was generated from the following files: