Very simple library for controlling small graphic LCDs

Dependents:   LCD

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers lcd.h Source File

lcd.h

Go to the documentation of this file.
00001 /** @file lcd.h */
00002 #ifndef LCD_H_
00003 #define LCD_H_
00004 
00005 #include "mbed.h"
00006 
00007 union Dots
00008 {
00009     uint16_t word;
00010     char byte[2];
00011 }; 
00012 
00013 struct GbufMem
00014 { 
00015     bool refresh; // Refresh needed?
00016     Dots dots[10][32]; // 160x32 pixels LCD
00017 };
00018 
00019 /** gfxLcd class
00020  * 
00021  * This class is used for controlling the LCD.
00022  */
00023 class gfxLcd
00024 {
00025 private:
00026     void write(bool rs, char d);
00027 public:
00028     GbufMem fbuf; /**< Frame buffer for the LCD */
00029     
00030     /** Initialize LCD
00031     *
00032     */
00033     gfxLcd();
00034     
00035     /** Initialize LCD
00036     *
00037     */
00038     void init();
00039     
00040     /** Fill screen with black or white
00041     *
00042     * @param color true = black, false = white
00043     */
00044     void fillScreen(bool color);
00045     
00046     /** Set/clear pixel in framebuffer
00047     *
00048     * @param x x position of the pixel.
00049     * @param y y position of the pixel.
00050     * @param color true = set (black), false = clear (white)
00051     */
00052     void putPixel(char x, char y, bool color);
00053     
00054     /** Refresh display
00055     *
00056     */
00057     void update();
00058 };
00059 #endif