A simple library for SSH1106 controlled GLCDs
Diff: SSH1106.h
- Revision:
- 1:ac9efaadd666
- Parent:
- 0:3cd0a11a2f91
--- a/SSH1106.h Mon Dec 19 15:02:30 2016 +0000 +++ b/SSH1106.h Mon Dec 19 23:23:41 2016 +0000 @@ -51,14 +51,40 @@ // Clear screen void clear(void); - // Write text to LCD where font format is a 2-dimensional array (only 96x8, 8x8 pixel fonts supported) + // Write text to LCD where font format is a 2-dimensional array (only 96x8 byte, 8x8 pixel fonts supported) void writeText2d(char column, char page, const char font_address[96][8], const char *text, int size); - // Write text to LCD where font format is a 1-dimensional array. Fonts bigger than 8 pix high should work but isn't tested + // Write text to LCD where font format is a 1-dimensional array. >8 pixel fonts are not working yet, will update soon void writeText(char column, char page, const char *font_address, const char *str, const uint8_t size); // Draw a 128x64 pixel bitmap void drawBitmap(const char *data); + + // Draw a horizontal line, start positions / height / width in pixels + void drawLineHor(char posx, char posy, char height, char width); + + // Draw a vertical line, start positions / height / width in pixels + void drawLineVert(char posx, char posy, char height, char width); + + //----------------------------------------------------------------------------------------------------------------------------- + // Functions below are buffered versions; possible to write things on top of each other without clearing pixels (ORs all data). + // Use update() to write buffer to LCD. + // Clear buffer before writing 1st time (initialize all values) + // writetext / drawbitmap will be added soon + //----------------------------------------------------------------------------------------------------------------------------- + + // Clear buffer + void clearBuffer(void); + + // Write buffer to LCD + void update(void); + + // Draw a horizontal line, start positions / height / width in pixels. Buffered version; possible to write things on top of each other + // without clearing pixels (ORs all data). Use update() to write buffer to LCD + void drawbufferLineHor(char posx, char posy, char height, char width); + + // Draw a vertical line, start positions / height / width in pixels. Buffered version. + void drawbufferLineVert(char posx, char posy, char height, char width); private: @@ -67,6 +93,7 @@ DigitalOut *_lcd_cd; DigitalOut *_lcd_rst; uint8_t _lcdbuffer[LCDWIDTH*LCDPAGES]; + char buff[LCDWIDTH*LCDPAGES]; };