Main Page   Modules   Data Structures   File List   Data Fields   Globals  

ks0108.h

Go to the documentation of this file.
00001 /*! \file ks0108.h \brief Graphic LCD driver for HD61202/KS0108 displays. */
00002 //*****************************************************************************
00003 //
00004 // File Name    : 'ks0108.h'
00005 // Title        : Graphic LCD driver for HD61202/KS0108 displays
00006 // Author       : Pascal Stang - Copyright (C) 2001-2003
00007 // Date         : 10/19/2002
00008 // Revised      : 5/1/2003
00009 // Version      : 0.5
00010 // Target MCU   : Atmel AVR
00011 // Editor Tabs  : 4
00012 //
00013 // NOTE: This code is currently below version 1.0, and therefore is considered
00014 // to be lacking in some functionality or documentation, or may not be fully
00015 // tested.  Nonetheless, you can expect most functions to work.
00016 //
00017 // This code is distributed under the GNU Public License
00018 //      which can be found at http://www.gnu.org/licenses/gpl.txt
00019 //
00020 //*****************************************************************************
00021 
00022 
00023 #ifndef KS0108_H
00024 #define KS0108_H
00025 
00026 #include "global.h"
00027 
00028 #include "ks0108conf.h"
00029 
00030 // HD61202/KS0108 command set
00031 #define GLCD_ON_CTRL        0x3E    // 0011111X: lcd on/off control
00032 #define GLCD_ON_DISPLAY     0x01    //      DB0: turn display on
00033 
00034 #define GLCD_START_LINE     0xC0    // 11XXXXXX: set lcd start line
00035 
00036 #define GLCD_SET_PAGE       0xB8    // 10111XXX: set lcd page (X) address
00037 #define GLCD_SET_Y_ADDR     0x40    // 01YYYYYY: set lcd Y address
00038 
00039 #define GLCD_STATUS_BUSY    0x80    // (1)->LCD IS BUSY
00040 #define GLCD_STATUS_ONOFF   0x20    // (0)->LCD IS ON
00041 #define GLCD_STATUS_RESET   0x10    // (1)->LCD IS RESET
00042 
00043 // determine the number of controllers
00044 // (make sure we round up for partial use of more than one controller)
00045 #define GLCD_NUM_CONTROLLERS    ((GLCD_XPIXELS+GLCD_CONTROLLER_XPIXELS-1)/GLCD_CONTROLLER_XPIXELS)
00046 
00047 // typedefs/structures
00048 typedef struct struct_GrLcdCtrlrStateType
00049 {
00050     unsigned char xAddr;
00051     unsigned char yAddr;
00052 } GrLcdCtrlrStateType;
00053 
00054 typedef struct struct_GrLcdStateType
00055 {
00056     unsigned char lcdXAddr;
00057     unsigned char lcdYAddr;
00058     GrLcdCtrlrStateType ctrlr[GLCD_NUM_CONTROLLERS];
00059 } GrLcdStateType;
00060 
00061 // function prototypes
00062 void glcdInitHW(void);
00063 void glcdBusyWait(u08 controller);
00064 void glcdControlWrite(u08 controller, u08 data);
00065 u08  glcdControlRead(u08 controller);
00066 void glcdDataWrite(u08 data);
00067 u08  glcdDataRead(void);
00068 void glcdSetXAddress(u08 xAddr);
00069 void glcdSetYAddress(u08 yAddr);
00070 
00071 
00072 //! Initialize the display, clear it, and prepare it for access
00073 void glcdInit(void);
00074 //! Clear the display
00075 void glcdClearScreen(void);
00076 //! Set display memory access point back to upper,left corner
00077 void glcdHome(void);
00078 //! Set display memory access point to row [line] and column [col] assuming 5x7 font
00079 void glcdGotoChar(u08 line, u08 col);
00080 //! Set display memory access point to [x] horizontal pixel and [y] vertical line
00081 void glcdSetAddress(u08 x, u08 yLine);
00082 //! Set display memory access point to row [line] and column [col] assuming 5x7 font
00083 void glcdStartLine(u08 start);
00084 //! Generic delay routine for timed glcd access
00085 void glcdDelay(u16 p);
00086 #endif

Generated on Sun Feb 22 19:12:31 2004 for Procyon AVRlib by doxygen1.3-rc2