Very simple library for controlling small graphic LCDs

Dependents:   LCD

Committer:
HBP
Date:
Thu Mar 03 00:28:24 2011 +0000
Revision:
0:573607103077
Child:
1:9ae4e5352e19
Initial release

Who changed what in which revision?

UserRevisionLine numberNew contents of line
HBP 0:573607103077 1 /** @file lcd.h */
HBP 0:573607103077 2 #ifndef LCD_H_
HBP 0:573607103077 3 #define LCD_H_
HBP 0:573607103077 4
HBP 0:573607103077 5 #include "mbed.h"
HBP 0:573607103077 6
HBP 0:573607103077 7 union Dots
HBP 0:573607103077 8 {
HBP 0:573607103077 9 uint16_t word;
HBP 0:573607103077 10 char byte[2];
HBP 0:573607103077 11 };
HBP 0:573607103077 12
HBP 0:573607103077 13 struct GbufMem
HBP 0:573607103077 14 {
HBP 0:573607103077 15 bool refresh; // Refresh needed?
HBP 0:573607103077 16 Dots dots[10][32]; // 160x32 pixels LCD
HBP 0:573607103077 17 };
HBP 0:573607103077 18
HBP 0:573607103077 19 class gfxLcd
HBP 0:573607103077 20 {
HBP 0:573607103077 21 private:
HBP 0:573607103077 22 void write(bool rs, char d);
HBP 0:573607103077 23 public:
HBP 0:573607103077 24 GbufMem fbuf; /**< Frame buffer for the LCD */
HBP 0:573607103077 25
HBP 0:573607103077 26 /** Initialize LCD
HBP 0:573607103077 27 *
HBP 0:573607103077 28 */
HBP 0:573607103077 29 gfxLcd();
HBP 0:573607103077 30
HBP 0:573607103077 31 /** Initialize LCD
HBP 0:573607103077 32 *
HBP 0:573607103077 33 */
HBP 0:573607103077 34 void init();
HBP 0:573607103077 35
HBP 0:573607103077 36 /** Fill screen with black or white
HBP 0:573607103077 37 *
HBP 0:573607103077 38 * @param color true = black, false = white
HBP 0:573607103077 39 */
HBP 0:573607103077 40 void fillScreen(bool color);
HBP 0:573607103077 41
HBP 0:573607103077 42 /** Set/clear pixel in framebuffer
HBP 0:573607103077 43 *
HBP 0:573607103077 44 * @param x x position of the pixel.
HBP 0:573607103077 45 * @param y y position of the pixel.
HBP 0:573607103077 46 * @param color true = set (black), false = clear (white)
HBP 0:573607103077 47 */
HBP 0:573607103077 48 void putPixel(char x, char y, bool color);
HBP 0:573607103077 49
HBP 0:573607103077 50 /** Refresh display
HBP 0:573607103077 51 *
HBP 0:573607103077 52 */
HBP 0:573607103077 53 void update();
HBP 0:573607103077 54 };
HBP 0:573607103077 55 #endif