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:
- 1:17443d6d2740
- Parent:
- 0:6ac8f630d9a0
- Child:
- 3:c0e409cda493
--- a/lcd128lib.h Sat Feb 01 13:13:37 2014 +0000 +++ b/lcd128lib.h Sat Feb 01 15:37:54 2014 +0000 @@ -15,7 +15,7 @@ #define LCD_X 128 #define LCD_Y 4 #define LCD_SIZE 512 - + // // Proportional font // @@ -26,7 +26,21 @@ const char** glyphs; } lcd128font; -// +// +// Progress bar shape +// Drawed as BFFF...FFUU...UUUE +// B - Begin one +// F - Filled zone +// U - Empty zone +// E - End one +// + +#define LCD_BAR_B 0x1c +#define LCD_BAR_F 0x3e +#define LCD_BAR_U 0x22 +#define LCD_BAR_E 0x1c + +// // lcd128 class // @@ -39,8 +53,10 @@ // Current font lcd128font font; + // Write options bool invert; bool bold; + bool underline; // buffer char buffer[LCD_SIZE]; @@ -69,6 +85,7 @@ // Write mode void Invert(bool invert = true); // Switch inverting of chars void Bold(bool bold = true); // Switch bold mode (repeat each char row twice) + void Underline(bool underline = true); // Switch underline mode (last pixel of row always on) // Cursor void XY(int x = 0, int y = 0); // Change write position X in pixels, Y in rows @@ -88,5 +105,8 @@ 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 + void Bar(int width, float fill = 0.0); // Progress bar - one row, width pixels, fill - 0.0..1.0 + };