Very simple library for controlling small graphic LCDs
Diff: lcd.h
- Revision:
- 0:573607103077
- Child:
- 1:9ae4e5352e19
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/lcd.h Thu Mar 03 00:28:24 2011 +0000 @@ -0,0 +1,55 @@ +/** @file lcd.h */ +#ifndef LCD_H_ +#define LCD_H_ + +#include "mbed.h" + +union Dots +{ + uint16_t word; + char byte[2]; +}; + +struct GbufMem +{ + bool refresh; // Refresh needed? + Dots dots[10][32]; // 160x32 pixels LCD +}; + +class gfxLcd +{ +private: + void write(bool rs, char d); +public: + GbufMem fbuf; /**< Frame buffer for the LCD */ + + /** Initialize LCD + * + */ + gfxLcd(); + + /** Initialize LCD + * + */ + void init(); + + /** Fill screen with black or white + * + * @param color true = black, false = white + */ + void fillScreen(bool color); + + /** Set/clear pixel in framebuffer + * + * @param x x position of the pixel. + * @param y y position of the pixel. + * @param color true = set (black), false = clear (white) + */ + void putPixel(char x, char y, bool color); + + /** Refresh display + * + */ + void update(); +}; +#endif