Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: lcd128lib.h
- Revision:
- 5:ff31feb7d966
- Parent:
- 4:1bd241d1fad0
- Child:
- 6:5cd32671a837
--- a/lcd128lib.h Mon May 26 20:14:58 2014 +0000
+++ b/lcd128lib.h Wed May 28 10:09:01 2014 +0000
@@ -12,18 +12,18 @@
// 512 byte total buffer size
//
-#define LCD_X 128 // In pixels
-#define LCD_Y 4 // In rows by 8 pixels each
-#define LCD_SIZE 512 // In bytes, = LCD_X*LCD_Y
+#define LCD_X 128 // In pixels
+#define LCD_Y 4 // In rows by 8 pixels each
+#define LCD_SIZE 512 // In bytes, = LCD_X*LCD_Y
//
// Proportional font
//
typedef struct {
- char first_code, glyphs_total;
- const char* widths;
- const char** glyphs;
+ unsigned char first_code, glyphs_total;
+ const unsigned char* widths;
+ const unsigned char** glyphs;
} lcd128font;
//
@@ -35,10 +35,20 @@
// E - End one
//
-#define LCD_BAR_B 0x1c
-#define LCD_BAR_F 0x3e
-#define LCD_BAR_U 0x22
-#define LCD_BAR_E 0x1c
+#define LCD_BAR_B 0x1c
+#define LCD_BAR_F 0x3e
+#define LCD_BAR_U 0x22
+#define LCD_BAR_E 0x1c
+
+//
+// Special Glyphs for menu / interface
+//
+
+#define LCD_RADIO_OFF 128
+#define LCD_RADIO_ON 129
+#define LCD_CHECKBOX_OFF 130
+#define LCD_CHECKBOX_ON 131
+#define LCD_SELECTOR 132
//
// lcd128 class
@@ -59,13 +69,13 @@
bool underline;
// buffer
- char buffer[LCD_SIZE];
+ unsigned char buffer[LCD_SIZE];
// Cursor position
int X, Y;
// SPI writer with data / command
- void write(char byte, bool cmd = false);
+ void write(unsigned char byte, bool cmd = false);
public:
@@ -90,10 +100,10 @@
void XY(int x = 0, int y = 0); // Change write position X in pixels, Y in rows
// Vertical 8bit pixel row
- void Write(char byte); // One 8bit row
- void Write(char byte, int count); // One 8bit row * 'count' times
- void Write(char* data, int size); // 'size' 8bit rows
- void Write2(char* data, int size); // Bold: 'size' 8bit rows * 2
+ void Write(unsigned char byte); // One 8bit row
+ void Write(unsigned char byte, int count); // One 8bit row * 'count' times
+ void Write(unsigned char * data, int size); // 'size' 8bit rows
+ void Write2(unsigned char * data, int size); // Bold: 'size' 8bit rows * 2
// Character drawing
void Character(char chr); // Draw one font character (with invert and bold opt-s)