| Line No. | Rev | Author | Line |
|---|---|---|---|
| 1 | 6 | kaklik | /*! \file ks0108.h \brief Graphic LCD driver for HD61202/KS0108 displays. */ |
| 2 | //***************************************************************************** |
||
| 3 | // |
||
| 4 | // File Name : 'ks0108.h' |
||
| 5 | // Title : Graphic LCD driver for HD61202/KS0108 displays |
||
| 6 | // Author : Pascal Stang - Copyright (C) 2001-2003 |
||
| 7 | // Date : 10/19/2002 |
||
| 8 | // Revised : 5/1/2003 |
||
| 9 | // Version : 0.5 |
||
| 10 | // Target MCU : Atmel AVR |
||
| 11 | // Editor Tabs : 4 |
||
| 12 | // |
||
| 13 | // NOTE: This code is currently below version 1.0, and therefore is considered |
||
| 14 | // to be lacking in some functionality or documentation, or may not be fully |
||
| 15 | // tested. Nonetheless, you can expect most functions to work. |
||
| 16 | // |
||
| 17 | /// \ingroup driver_hw |
||
| 18 | /// \defgroup ks0108 Graphic LCD Driver for HD61202/KS0108-based Displays (ks0108.c) |
||
| 19 | /// \code #include "ks0108.h" \endcode |
||
| 20 | /// \par Overview |
||
| 21 | /// This display driver performs the basic functions necessary to access |
||
| 22 | /// any graphic LCD based on the KS0108 or HD61202 controller chip. For more |
||
| 23 | /// advanced functions, use this driver in conjunction with glcd.c. |
||
| 24 | /// KS0108/HD61202 displays typically range in size from 64x32 pixels to |
||
| 25 | /// 128x128 pixels and up to 3" square. To determine whether a display is |
||
| 26 | /// compatible, you should look for the above controller chips to be mounted |
||
| 27 | /// on the PC board attached to the display glass. The controller chips are |
||
| 28 | /// about 1/2" x 3/4" and have 80+ pins. On larger displays, you may also see |
||
| 29 | /// slave LCD driver chips with the numbers KS0107 or HD61203. The display |
||
| 30 | /// will likely have an 18 or 20-pin interface. The interface from the LCD |
||
| 31 | /// to an AVR processor does not require any additional hardware. If you can |
||
| 32 | /// locate a datasheet for your display, that plus the information in the |
||
| 33 | /// ks0108conf.h file should be all you need to get hooked up. |
||
| 34 | // |
||
| 35 | // This code is distributed under the GNU Public License |
||
| 36 | // which can be found at http://www.gnu.org/licenses/gpl.txt |
||
| 37 | // |
||
| 38 | //***************************************************************************** |
||
| 39 | |||
| 40 | |||
| 41 | #ifndef KS0108_H |
||
| 42 | #define KS0108_H |
||
| 43 | |||
| 44 | #include "global.h" |
||
| 45 | |||
| 46 | #include "ks0108conf.h" |
||
| 47 | |||
| 48 | // HD61202/KS0108 command set |
||
| 49 | #define GLCD_ON_CTRL 0x3E // 0011111X: lcd on/off control |
||
| 50 | #define GLCD_ON_DISPLAY 0x01 // DB0: turn display on |
||
| 51 | |||
| 52 | #define GLCD_START_LINE 0xC0 // 11XXXXXX: set lcd start line |
||
| 53 | |||
| 54 | #define GLCD_SET_PAGE 0xB8 // 10111XXX: set lcd page (X) address |
||
| 55 | #define GLCD_SET_Y_ADDR 0x40 // 01YYYYYY: set lcd Y address |
||
| 56 | |||
| 57 | #define GLCD_STATUS_BUSY 0x80 // (1)->LCD IS BUSY |
||
| 58 | #define GLCD_STATUS_ONOFF 0x20 // (0)->LCD IS ON |
||
| 59 | #define GLCD_STATUS_RESET 0x10 // (1)->LCD IS RESET |
||
| 60 | |||
| 61 | // determine the number of controllers |
||
| 62 | // (make sure we round up for partial use of more than one controller) |
||
| 63 | #define GLCD_NUM_CONTROLLERS ((GLCD_XPIXELS+GLCD_CONTROLLER_XPIXELS-1)/GLCD_CONTROLLER_XPIXELS) |
||
| 64 | |||
| 65 | // typedefs/structures |
||
| 66 | typedef struct struct_GrLcdCtrlrStateType |
||
| 67 | { |
||
| 68 | unsigned char xAddr; |
||
| 69 | unsigned char yAddr; |
||
| 70 | } GrLcdCtrlrStateType; |
||
| 71 | |||
| 72 | typedef struct struct_GrLcdStateType |
||
| 73 | { |
||
| 74 | unsigned char lcdXAddr; |
||
| 75 | unsigned char lcdYAddr; |
||
| 76 | GrLcdCtrlrStateType ctrlr[GLCD_NUM_CONTROLLERS]; |
||
| 77 | } GrLcdStateType; |
||
| 78 | |||
| 79 | // function prototypes |
||
| 80 | void glcdInitHW(void); |
||
| 81 | void glcdBusyWait(u08 controller); |
||
| 82 | void glcdControlWrite(u08 controller, u08 data); |
||
| 83 | u08 glcdControlRead(u08 controller); |
||
| 84 | void glcdDataWrite(u08 data); |
||
| 85 | u08 glcdDataRead(void); |
||
| 86 | void glcdSetXAddress(u08 xAddr); |
||
| 87 | void glcdSetYAddress(u08 yAddr); |
||
| 88 | |||
| 89 | |||
| 90 | //! Initialize the display, clear it, and prepare it for access |
||
| 91 | void glcdInit(void); |
||
| 92 | //! Clear the display |
||
| 93 | void glcdClearScreen(void); |
||
| 94 | //! Set display memory access point back to upper,left corner |
||
| 95 | void glcdHome(void); |
||
| 96 | //! Set display memory access point to row [line] and column [col] assuming 5x7 font |
||
| 97 | void glcdGotoChar(u08 line, u08 col); |
||
| 98 | //! Set display memory access point to [x] horizontal pixel and [y] vertical line |
||
| 99 | void glcdSetAddress(u08 x, u08 yLine); |
||
| 100 | //! Set display memory access point to row [line] and column [col] assuming 5x7 font |
||
| 101 | void glcdStartLine(u08 start); |
||
| 102 | //! Generic delay routine for timed glcd access |
||
| 103 | void glcdDelay(u16 p); |
||
| 104 | #endif |
Powered by WebSVN v2.8.3