lcd.h

Go to the documentation of this file.
00001 /*
00002  * File:        lcd.h
00003  * Purpose:     Prototypes of Nokia 6610 LCD handling functions
00004  * Author:      Peter Ivanov, Olimex Ltd.
00005  * Modified by:
00006  * Created:     2007-05-19 11:29:32
00007  * Last modify: 2007-10-21 10:37:03 ivanovp {Time-stamp}
00008  * Copyright:   (C) Peter Ivanov, Olimex Ltd., 2007
00009  * Licence:     GPL
00010  */
00016 #ifndef __INCLUDE_LCD_H
00017 #define __INCLUDE_LCD_H
00018 
00019 // Nokia 6610 LCD type is GE12 or GE8?
00020 // NOTE: You should uncomment next line if you've got LCD type GE12.
00021 //#define GE12
00022 
00023 #define LCD_PRINTF_BUF_SIZE 256
00024 
00025 #define LCD_BKLGHT_ON   1
00026 #define LCD_BKLGHT_OFF  0
00027 
00028 #define LCD_X_OFFSET    0
00029 #ifdef GE12
00030 #define LCD_Y_OFFSET    0
00031 #else
00032 #define LCD_Y_OFFSET    2
00033 #endif
00034 
00035 #define LCD_COLOR_BLACK         0x070           
00036 #define LCD_COLOR_YELLOW        0x1EF           
00037 #define LCD_COLOR_GRAY          0xCCC           
00038 #define LCD_COLOR_BLUE          0xF00           
00039 #define LCD_COLOR_GREEN         0x0F0           
00040 #define LCD_COLOR_RED           0x00F           
00041 #define LCD_COLOR_WHITE         0xFFF           
00042 #define LCD_DEFAULT_FG_COLOR    LCD_COLOR_BLACK   // black
00043 #define LCD_DEFAULT_BG_COLOR    LCD_COLOR_WHITE   // white
00044 
00045 // Warning: maybe some correction needed to GE12!!!
00046 #define LCD_WIDTH               (130)     
00047 #define LCD_HEIGHT              (131)     
00048 #define LCD_COLORS              (4096)    
00049 //#define LCD_MEM_SIZE          (25350)   // 130*130*12/8
00050 #define LCD_MEM_SIZE            (25740)   
00051 
00052 
00055 void LCD_init (void);
00056 
00062 void LCD_setBacklight (unsigned char state);
00063 
00070 void LCD_write130x130bmp (const unsigned char *bmp);
00071 
00079 void LCD_write130x130bmpStart ();
00080 
00087 void LCD_write130x130bmpData16 (const uint16_t *data);
00088 
00095 void LCD_write130x130bmpData8 (const uint8_t *data);
00096 
00101 void LCD_write130x130bmpEnd ();
00102 
00106 void LCD_clear(void);
00107 
00114 void LCD_clearBall (unsigned char x, unsigned char y);
00115 
00122 void LCD_writeBall (unsigned char x, unsigned char y);
00123 
00129 void LCD_setContrast (unsigned char contrast);
00130 
00137 void LCD_writeChar(unsigned char Ascii, 
00138                   unsigned char x,
00139                   unsigned char y,
00140                   unsigned short FG_Colour, unsigned short BG_Colour);
00141 
00149 inline void LCD_setX (uint8_t x);
00150 
00158 inline void LCD_setY (uint8_t y);
00159 
00167 inline uint8_t LCD_getX ();
00168 
00176 inline uint8_t LCD_getY ();
00177 
00186 inline void LCD_setXY (uint8_t x, uint8_t y);
00187 
00194 inline void LCD_setFGColor (uint16_t fgColor);
00195 
00202 inline void LCD_setBGColor (uint16_t bgColor);
00203 
00211 inline void LCD_setColor (uint16_t fgColor, uint16_t bgColor);
00212 
00221 void LCD_write (const char *buf, uint16_t length);
00222 
00236 void LCD_printf (const char *fmt, ...);
00237 
00238 #ifdef GE12
00239 
00240 #define NOP           0x00     // nop
00241 #define SOFTRST       0x01     // software reset
00242 #define BOOSTVOFF     0x02     // booster voltage OFF
00243 #define BOOSTVON      0x03     // booster voltage ON
00244 #define TESTMODE1     0x04     // test mode
00245 #define DISPSTATUS    0x09     // display status
00246 #define SLEEPIN       0x10     // sleep in
00247 #define SLEEPOUT      0x11     // sleep out
00248 #define PARTIAL       0x12     // partial display mode
00249 #define NORMALMODE    0x13     // display normal mode
00250 #define INVERSIONOFF  0x20     // inversion OFF
00251 #define INVERSIONON   0x21     // inversion ON
00252 #define ALLPIXELOFF   0x22     // all pixel OFF
00253 #define ALLPIXELON    0x23     // all pixel ON
00254 #define CONTRAST      0x25     // write contrast
00255 #define DISPLAYOFF    0x28     // display OFF
00256 #define DISPLAYON     0x29     // display ON
00257 #define COLADDRSET    0x2A     // column address set
00258 #define PAGEADDRSET   0x2B     // page address set
00259 #define MEMWRITE      0x2C     // memory write
00260 #define COLORSET      0x2D     // colour set
00261 #define READRAMDATA   0x2E     // RAM data read
00262 #define PARTIALAREA   0x30     // partial area
00263 #define VERTSCROLL    0x33     // vertical scrolling definition
00264 #define TESTMODE2     0x34     // test mode
00265 #define TESTMODE3     0x35     // test mode
00266 #define ACCESSCTRL    0x36     // memory access control
00267 #define VSCRLSADDR    0x37     // vertical scrolling start address
00268 #define IDLEOFF       0x38     // idle mode OFF
00269 #define IDLEON        0x39     // idle mode ON
00270 #define PIXELFORMAT   0x3A     // interface pixel format
00271 #define TESTMODE4     0xDE     // test mode
00272 #define NOP2          0xAA     // nop
00273 #define INITESC       0xC6     // initial escape
00274 #define TESTMODE5     0xDA     // test mode
00275 #define TESTMODE6     0xDB     // test mode
00276 #define TESTMODE7     0xDC     // test mode
00277 #define TESTMODE8     0xB2     // test mode
00278 #define GRAYSCALE0    0xB3     // gray scale position set 0
00279 #define GRAYSCALE1    0xB4     // gray scale position set 1
00280 #define GAMMA         0xB5     // gamma curve set
00281 #define DISPCTRL      0xB6     // display control
00282 #define TEMPGRADIENT  0xB7     // temp gradient set
00283 #define TESTMODE9     0xB8     // test mode
00284 #define REFSET        0xB9     // refresh set
00285 #define VOLTCTRL      0xBA     // voltage control
00286 #define COMMONDRV     0xBD     // common driver output select
00287 #define PWRCTRL       0xBE     // power control
00288 
00289 #else
00290 
00291 #define DISON     0xAF      // Display on
00292 #define DISOFF    0xAE      // Display off
00293 #define DISPLAYON   DISON
00294 #define DISPLAYOFF  DISOFF
00295 #define DISNOR    0xA6      // Normal display
00296 #define DISINV    0xA7      // Inverse display
00297 #define COMSCN    0xBB      // Common scan direction
00298 #define DISCTL    0xCA      // Display control
00299 //  #define DISCTL    0xBA      // Display control
00300 #define SLPIN     0x95      // Sleep in
00301 #define SLPOUT    0x94      // Sleep out
00302 #define PASET     0x75      // Page address set
00303 #define CASET     0x15      // Column address set
00304 #define PAGEADDRSET PASET
00305 #define COLADDRSET  CASET
00306 #define DATCTL    0xBC      // Data scan direction, etc.
00307 #define RGBSET8   0xCE      // 256-color position set
00308 #define RAMWR     0x5C      // Writing to memory
00309 #define MEMWRITE    RAMWR
00310 #define RAMRD     0x5D      // Reading from memory
00311 #define PTLIN     0xA8      // Partial display in
00312 #define PTLOUT    0xA9      // Partial display out
00313 #define RMWIN     0xE0      // Read and modify write
00314 #define RMWOUT    0xEE      // End
00315 #define ASCSET    0xAA      // Area scroll set
00316 #define SCSTART   0xAB      // Scroll start set
00317 #define IOSCON    0xD1      // Internal oscillation on
00318 #define IOSCOFF   0xD2      // Internal oscillation off
00319 #define PWRCTR    0x20      // Power control
00320 #define VOLCTR    0x81      // Electronic volume control
00321 #define VOLUP     0xD6      // Increment electronic control by 1
00322 #define VOLDOWN   0xD7      // Decrement electronic control by 1
00323 #define TMPGRD    0x82      // Temperature gradient set
00324 #define EPCTIN    0xCD      // Control EEPROM
00325 #define EPCOUT    0xCC      // Cancel EEPROM control
00326 #define EPMWR     0xFC      // Write into EEPROM
00327 #define EPMRD     0xFD      // Read from EEPROM
00328 #define EPSRRD1   0x7C      // Read register 1
00329 #define EPSRRD2   0x7D      // Read register 2
00330 #define NOP       0x25      // NOP instruction
00331 
00332 #endif
00333 #endif // __INCLUDE_LCD_H

Generated on Sun Dec 9 17:17:10 2007 for Sample MSP430-4619LCD Project by  doxygen 1.5.1