- #ifndef _M128128_H
- #define _M128128_H
- /*********************************************************************
- Filename: M128128.h
- Revised: $Date: $
- Revision: $Revision: $
- Writer:
- Description: LCD驱动程序,包括底层驱动,刷新显示子程序
- *********************************************************************/
- /*********************************************************************
- * INCLUDES
- */
- #include "includes.h"
- /*********************************************************************
- * CONSTANTS
- */
- #define LOW 0
- #define HIGH 1
- //#define ESC_KEY 0x1b
- #define LCD_DISP_ON 0x3f // Controls the display onor off. Internal status and
- #define LCD_DISP_OFF 0x3e // display RAM data is not affected.L:OFF, H:ON
- #define LCD_SET_X( X ) ( 0x40 + X )
- #define LCD_SET_Y( Y ) ( 0xb8 + Y )
- #define LCD_DISP_START_L( L ) ( 0xc0 + L )
- #define LCD_STATUS_BUSY 0x80
- #define LCD_STATUS_READ() ( 0x80 & LCD_DATA_BUS )
- #define UCOS_EN 1
- /*********************************************************************
- * MACROS
- */
- #define LCD_DATA_BUS 0
- #define LCD_CONTROL_BUS 0
- #define LCD_DATA_BUS_CON 0
- #define LCD_CONTROL_BUS_CON 0
- #define PAGE_ALL_S ( ( LCD_CONTROL_BUS & 0xff ) | 0x0f )
- #define PAGE_ALL_DS ( LCD_CONTROL_BUS & 0xf0 )
- #define PAGE_1 ( ( LCD_CONTROL_BUS & 0xf0 ) | 0x01 )
- #define PAGE_2 ( ( LCD_CONTROL_BUS & 0xf0 ) | 0x02 )
- #define PAGE_3 ( ( LCD_CONTROL_BUS & 0xf0 ) | 0x04 )
- #define PAGE_4 ( ( LCD_CONTROL_BUS & 0xf0 ) | 0x08 )
- #define LCD_DATA_BUS_INIT() ( LCD_DATA_BUS_CON = ( ( LCD_DATA_BUS_CON & 0xffff0000 ) | 0x5555 ) )
- #define LCD_CONTROL_BUS_INIT() ( LCD_CONTROL_BUS_CON = 0x5555 )
- #define CMD ( LCD_CONTROL_BUS & ~0x10 )
- #define DAT ( LCD_CONTROL_BUS | 0x10 )
- #define WRITE ( LCD_CONTROL_BUS & ~0x20 )
- #define READ ( LCD_CONTROL_BUS | 0x20 )
- #define ENABLE ( LCD_CONTROL_BUS & ~0x40 )
- #define DISNABLE ( LCD_CONTROL_BUS | 0x40 )
- #define RESET ( LCD_CONTROL_BUS & ~0x80 )
- #define WORK ( LCD_CONTROL_BUS | 0x80 )
- #define LCD_PAGE_CS( PAGE_x ) ( LCD_CONTROL_BUS = PAGE_x )//( LCD_CONTROL_BUS & 0xf0 ) | ( 0x01 << PAGE_x ) )
- #define RS( x ) ( LCD_CONTROL_BUS = x )
- #define RW( x ) ( LCD_CONTROL_BUS = x )
- #define CE( x ) ( LCD_CONTROL_BUS = x )
- #define LCD_RESET( rst ) ( LCD_CONTROL_BUS = rst )
- /*********************************************************************
- * TYPEDEFS
- */
- typedef enum _LCD_PAGE
- {
- CS1,
- CS2,
- CS3,
- CS4,
- CS_ALL
- }LcdPage_s;
- typedef enum _DATA_DISP_MODE
- {
- REVERSE_DISP,
- NORMAL_DISP
- }DataDiapMode_s;
- typedef enum _LCD_SET_COORDINATE
- {
- SET_X = 1,
- SET_Y,
- SET_X_Y
- }LcdSetCoordinate_s;
- typedef struct _LCD_SET_DISP
- {
- INT32U x;
- INT32U y;
- INT8U mode;
- }LcdDispArea_s;
- typedef struct _LCD_DISP_CURSOR
- {
- int x;
- int y;
- }LcdDispCursor_s;
- /*********************************************************************
- * GLOBAL VARIABLES
- */
- extern LcdDispArea_s DispArea;
- extern LcdDispCursor_s LcdCursor;
- /*********************************************************************
- * LOCAL VARIABLES
- */
- /*********************************************************************
- * GLOBAL FUNCTIONS
- */
- /******************************************************************************************************************
- * 函数名称:Refresh_FrameBuffer()
- * 功 能:刷新屏幕。
- * 入口参数:无
- * 出口参数:无
- *******************************************************************************************************************/
- extern void RefreshFrameBuffer( INT8U disp_mode );
- /*********************************************************************
- * LOCAL FUNCTIONS
- */
- /*********************************************************************
- *********************************************************************/
- #endif