A lib for accessing ST7626 based lcds. It provides a set_pixel function. It is only tested with one display.
Diff: font.c
- Revision:
- 5:70dcbb284628
- Parent:
- 4:a4925df73101
--- a/font.c Sat Jan 08 23:13:52 2011 +0000 +++ b/font.c Sun Jan 09 22:04:01 2011 +0000 @@ -1,7 +1,7 @@ #include "lcd.h" -#define BACKROUND_COLOR 0xFF +#define BACKROUND_COLOR 0xFFFF void Display5x7Font(char letter, char x, char y, int16_t color) { @@ -18,19 +18,16 @@ int sign = (letter - 0x20) * 5; unsigned char pos = 0x01; - unsigned char ColorHigh, ColorLow; for (i = 0; i < 8 ; i++) { for (j = 0 ; j < 5 ; j++) { //FIXME: is this aBUUUG????? char pixel = Font5x7[sign+j] & pos; if (pixel) { - ColorHigh = color; - ColorLow = color >> 8; + Write(DATA, (int8_t) color>>8); + Write(DATA, (int8_t) color); } else { - ColorHigh = BACKROUND_COLOR; - ColorLow = BACKROUND_COLOR; + Write(DATA,(int8_t) (BACKROUND_COLOR>>8)); + Write(DATA,(int8_t) (BACKROUND_COLOR)); } - Write(DATA, ColorHigh); - Write(DATA, ColorLow); } if (pos < 0x80) { pos = pos << 1; @@ -56,19 +53,16 @@ int sign = (letter - 0x20) * 5; unsigned char pos = 0x01; - unsigned char ColorHigh, ColorLow; for (i = 0; i < 8 ; i++) { for (j = 0 ; j < 5 ; j++) { char pixel = AnotherFont5x7[sign+j] & pos; if (pixel) { - ColorHigh = color; - ColorLow = color>>8 ; + Write(DATA, (int8_t) (color>>8)); + Write(DATA, (int8_t) (color)); } else { - ColorHigh = BACKROUND_COLOR; - ColorLow = BACKROUND_COLOR; + Write(DATA,(int8_t) (BACKROUND_COLOR>>8)); + Write(DATA,(int8_t) (BACKROUND_COLOR)); } - Write(DATA, ColorHigh); - Write(DATA, ColorLow); } if (pos < 0x80) { pos = pos << 1; @@ -94,19 +88,16 @@ int sign = (letter - 0x20) * 24; unsigned char pos = 0x01; - unsigned char ColorHigh, ColorLow; for (i = 0; i < 8 ; i++) { for (j = 0 ; j < 12 ; j++) { char pixel = Font12x16[sign+(j*2)] & pos; if (pixel) { - ColorHigh = color ; - ColorLow = color >>8; + Write(DATA, (int8_t) (color>>8)); + Write(DATA, (int8_t) (color)); } else { - ColorHigh = BACKROUND_COLOR; - ColorLow = BACKROUND_COLOR; + Write(DATA,(int8_t) (BACKROUND_COLOR>>8)); + Write(DATA,(int8_t) (BACKROUND_COLOR)); } - Write(DATA, ColorHigh); - Write(DATA, ColorLow); } if (pos < 0x80) { pos = pos << 1; @@ -132,14 +123,12 @@ for (j = 0 ; j < 12 ; j++) { char pixel = Font12x16[sign+(j*2)+1] & pos; if (pixel) { - ColorHigh = color; - ColorLow = color >> 8; + Write(DATA, (int8_t) (color>>8)); + Write(DATA, (int8_t) (color)); } else { - ColorHigh = BACKROUND_COLOR; - ColorLow = BACKROUND_COLOR; + Write(DATA,(int8_t) (BACKROUND_COLOR>>8)); + Write(DATA,(int8_t) (BACKROUND_COLOR)); } - Write(DATA, ColorHigh); - Write(DATA, ColorLow); } if (pos < 0x80) { pos = pos << 1;