Lib for the LCD display on mbed lab Board
Diff: C12832_lcd.h
- Revision:
- 1:66dd8afbfd06
- Parent:
- 0:4bbc531be6e2
- Child:
- 3:468cdccff7af
--- a/C12832_lcd.h Tue Oct 16 14:05:57 2012 +0000 +++ b/C12832_lcd.h Tue Oct 16 17:50:37 2012 +0000 @@ -19,7 +19,7 @@ #include "GraphicsDisplay.h" -/** optional Defines : +/** optional Defines : * #define debug_lcd 1 enable infos to PC_USB */ @@ -35,10 +35,10 @@ #define DMA_DEST_SSP1_TX (2UL << 6) #define DMA_DEST_SSP0_TX (0UL << 6) - /** Draw mode - * NORMAl - * XOR set pixel by xor the screen - */ +/** Draw mode + * NORMAl + * XOR set pixel by xor the screen + */ enum {NORMAL,XOR}; class C12832_LCD : public GraphicsDisplay @@ -101,95 +101,103 @@ * */ void line(int x0, int y0, int x1, int y1, int colour); - + /** draw a rect - * - * @param x0,y0 top left corner - * @param x1,y1 down right corner - * @param color 1 set pixel ,0 erase pixel - * * - */ - void rect(int x0, int y0, int x1, int y1, int colour); - - /** draw a filled rect - * - * @param x0,y0 top left corner - * @param x1,y1 down right corner - * @param color 1 set pixel ,0 erase pixel - * - */ - void fillrect(int x0, int y0, int x1, int y1, int colour); - - /** copy display buffer to lcd + * + * @param x0,y0 top left corner + * @param x1,y1 down right corner + * @param color 1 set pixel ,0 erase pixel + * * + */ + void rect(int x0, int y0, int x1, int y1, int colour); + + /** draw a filled rect + * + * @param x0,y0 top left corner + * @param x1,y1 down right corner + * @param color 1 set pixel ,0 erase pixel * */ - + void fillrect(int x0, int y0, int x1, int y1, int colour); + + /** copy display buffer to lcd + * + */ + void copy_to_lcd(void); /** set the orienation of the screen - * - */ + * + */ + + //void set_orientation(unsigned int o); - void set_orientation(unsigned int o); - -/** set the contrast of the screen - * - */ + /** set the contrast of the screen + * + * @param o contrast 0-63 + */ void set_contrast(unsigned int o); - -/** invert the screen - * - * @param o = 0 normal, 1 invert - */ + + /** read the contrast level + * + */ + unsigned int get_contrast(void); + + + + /** invert the screen + * + * @param o = 0 normal, 1 invert + */ void invert(unsigned int o); - -/** clear the screen - * - */ - virtual void cls(void); - -/** set the drawing mode - * - * @param mode NORMAl or XOR - */ - -void setmode(int mode); - - int columns(void); - - /** calculate the max number of columns - * - * @returns max column - * depends on actual font size - * - */ - int rows(void); - - /** put a char on the screen - * - * @param value char to print - * @returns printed char - * - */ - int _putc(int value); - - /** draw a character on given position out of the active font to the LCD - * - * @param x x-position of char (top left) - * @param y y-position - * @param c char to print - * - */ - virtual void character(int x, int y, int c); - - /** setup cursor position - * - * @param x x-position (top left) - * @param y y-position - */ - void locate(int x, int y); - + + /** clear the screen + * + */ + virtual void cls(void); + + /** set the drawing mode + * + * @param mode NORMAl or XOR + */ + + void setmode(int mode); + + int columns(void); + + /** calculate the max number of columns + * + * @returns max column + * depends on actual font size + * + */ + int rows(void); + + /** put a char on the screen + * + * @param value char to print + * @returns printed char + * + */ + int _putc(int value); + + /** draw a character on given position out of the active font to the LCD + * + * @param x x-position of char (top left) + * @param y y-position + * @param c char to print + * + */ + virtual void character(int x, int y, int c); + + /** setup cursor position + * + * @param x x-position (top left) + * @param y y-position + */ + void locate(int x, int y); + /** Vars */ SPI _spi; @@ -200,20 +208,20 @@ unsigned int draw_mode; - /** select the font to use - * - * @param f pointer to font array - * - * font array can created with GLCD Font Creator from http://www.mikroe.com - * you have to add 4 parameter at the beginning of the font array to use: - * - the number of byte / char - * - the vertial size in pixel - * - the horizontal size in pixel - * - the number of byte per vertical line - * you also have to change the array to char[] - * - */ - void set_font(unsigned char* f); + /** select the font to use + * + * @param f pointer to font array + * + * font array can created with GLCD Font Creator from http://www.mikroe.com + * you have to add 4 parameter at the beginning of the font array to use: + * - the number of byte / char + * - the vertial size in pixel + * - the horizontal size in pixel + * - the number of byte per vertical line + * you also have to change the array to char[] + * + */ + void set_font(unsigned char* f); protected: @@ -255,13 +263,14 @@ * */ void wr_cmd(unsigned char value); - + void wr_cnt(unsigned char cmd); unsigned int orientation; unsigned int char_x; unsigned int char_y; unsigned char buffer[512]; + unsigned int contrast; };