Lightweight proportional text library for C12832 LCD. Easy to modify, fast, robust and compact. Nice font, good for text driven menus, messages, etc. Fell free to use and modify in any projects.
Documentation will be here later.
Usage sample:
Import programapp-board-lcd128
Sample usage of lightweight C12832 LCD library
Diff: lcd128lib.h
- Revision:
- 6:5cd32671a837
- Parent:
- 5:ff31feb7d966
--- a/lcd128lib.h Wed May 28 10:09:01 2014 +0000 +++ b/lcd128lib.h Tue Oct 07 20:50:41 2014 +0000 @@ -46,9 +46,32 @@ #define LCD_RADIO_OFF 128 #define LCD_RADIO_ON 129 -#define LCD_CHECKBOX_OFF 130 -#define LCD_CHECKBOX_ON 131 -#define LCD_SELECTOR 132 +#define LCD_CHECK_OFF 130 +#define LCD_CHECK_ON 131 +#define LCD_SHORT_SPACE 132 +#define LCD_PLAY 133 +#define LCD_PAUSE 134 +#define LCD_FORWARD 135 +#define LCD_REVERSE 136 +#define LCD_BEGIN 137 +#define LCD_END 138 +#define LCD_PLAY_PAUSE 139 +#define LCD_CLOCK0 140 +#define LCD_CLOCK1 141 +#define LCD_CLOCK2 142 +#define LCD_CLOCK3 143 +#define LCD_CLOCK4 144 +#define LCD_CLOCK5 145 +#define LCD_CLOCK6 146 +#define LCD_CLOCK7 147 + +// +// Row text align +// + +#define LCD_ALIGN_LEFT 0 +#define LCD_ALIGN_CENTER 1 +#define LCD_ALIGN_RIGHT 2 // // lcd128 class @@ -80,7 +103,7 @@ public: // Supply LCD connected pin's here for your design - lcd128(PinName mosi= p5, PinName sclk = p7, PinName a0 = p8, PinName cs = p11, PinName rst = p6); + lcd128(PinName mosi = p5, PinName sclk = p7, PinName a0 = p8, PinName cs = p11, PinName rst = p6); // LCD control void Reset(); // Reset LCD, configure defaults @@ -89,7 +112,10 @@ // Buffer -> LCD void Update(); // Update LCD from buffer, actually shows drawed + + // All buffer operations void Clear(int row = -1); // Clear all buffer or one concrete row + void InverseRow(int row = -1, unsigned char mask = 255); // Inverse all buffer or one concrete row // Write mode void Invert(bool invert = true); // Switch inverting of chars @@ -114,8 +140,9 @@ void String(char* str); // Draw string proportionally int StringWidth(char* str); // Calculate string width in px - // Higher level drawers - void Row(int Y, char* str = ""); // Clear one text row and draw string on it (left aligned) - void RowCenter(int Y, char* str = ""); // Clear one text row and draw string on it (center aligned) + // Row drawer + void Row(int Y, char* str = "", bool inverse = false, int align = 0); // Clear one text row and draw string on it + + // Progress bar void Bar(int width, float fill = 0.0); // Progress bar - one row, width pixels, fill - 0.0..1.0 };