Very simple library for controlling small graphic LCDs
lcd.h@1:9ae4e5352e19, 2011-03-03 (annotated)
- Committer:
- HBP
- Date:
- Thu Mar 03 00:35:24 2011 +0000
- Revision:
- 1:9ae4e5352e19
- Parent:
- 0:573607103077
Docummentation fixed
Who changed what in which revision?
User | Revision | Line number | New 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 | 1:9ae4e5352e19 | 19 | /** gfxLcd class |
HBP | 1:9ae4e5352e19 | 20 | * |
HBP | 1:9ae4e5352e19 | 21 | * This class is used for controlling the LCD. |
HBP | 1:9ae4e5352e19 | 22 | */ |
HBP | 0:573607103077 | 23 | class gfxLcd |
HBP | 0:573607103077 | 24 | { |
HBP | 0:573607103077 | 25 | private: |
HBP | 0:573607103077 | 26 | void write(bool rs, char d); |
HBP | 0:573607103077 | 27 | public: |
HBP | 0:573607103077 | 28 | GbufMem fbuf; /**< Frame buffer for the LCD */ |
HBP | 0:573607103077 | 29 | |
HBP | 0:573607103077 | 30 | /** Initialize LCD |
HBP | 0:573607103077 | 31 | * |
HBP | 0:573607103077 | 32 | */ |
HBP | 0:573607103077 | 33 | gfxLcd(); |
HBP | 0:573607103077 | 34 | |
HBP | 0:573607103077 | 35 | /** Initialize LCD |
HBP | 0:573607103077 | 36 | * |
HBP | 0:573607103077 | 37 | */ |
HBP | 0:573607103077 | 38 | void init(); |
HBP | 0:573607103077 | 39 | |
HBP | 0:573607103077 | 40 | /** Fill screen with black or white |
HBP | 0:573607103077 | 41 | * |
HBP | 0:573607103077 | 42 | * @param color true = black, false = white |
HBP | 0:573607103077 | 43 | */ |
HBP | 0:573607103077 | 44 | void fillScreen(bool color); |
HBP | 0:573607103077 | 45 | |
HBP | 0:573607103077 | 46 | /** Set/clear pixel in framebuffer |
HBP | 0:573607103077 | 47 | * |
HBP | 0:573607103077 | 48 | * @param x x position of the pixel. |
HBP | 0:573607103077 | 49 | * @param y y position of the pixel. |
HBP | 0:573607103077 | 50 | * @param color true = set (black), false = clear (white) |
HBP | 0:573607103077 | 51 | */ |
HBP | 0:573607103077 | 52 | void putPixel(char x, char y, bool color); |
HBP | 0:573607103077 | 53 | |
HBP | 0:573607103077 | 54 | /** Refresh display |
HBP | 0:573607103077 | 55 | * |
HBP | 0:573607103077 | 56 | */ |
HBP | 0:573607103077 | 57 | void update(); |
HBP | 0:573607103077 | 58 | }; |
HBP | 0:573607103077 | 59 | #endif |