?? syslcd.c
字號:
/* sysLcd.c - Samsung SBC ARM7 LCD driver routines *//* Copyright 1984-2001 Wind River Systems, Inc. */#include "copyright_wrs.h"/*modification history--------------------01c,26apr01,m_h convert tabs to spaces for readability01b,19apr01,m_h add carriage routine at EOF to avoid compile warning01a,10apr01,g_h created*//* includes */#include "vxWorks.h"#include "config.h"#include "string.h"#include "sysLcd.h"/********************************************************************************* sysLcdClear - clear the LCD** This routine clear the LCD panel.** SEE ALSO: sysLcdInit(), sysLcdSetPos(), sysLcdWrite(), sysLcdWriteString().** RETURNS: N/A*/void sysLcdClear(void) { /* Clear LCD */ LCD_WRITE_COMMAND(LCD_CLEAR_COMMAND); /* Wait */ LCD_DELAY(200);}/********************************************************************************* sysLcdInit - initialize the SBC ARM7 board LCD** This routine initializes SBC ARM7 LCD panel. Normally, it is called from * sysHwInit() in sysLib.c.** SEE ALSO: sysLcdClear(), sysLcdSetPos(), sysLcdWrite(), sysLcdWriteString().** RETURNS: N/A*/void sysLcdInit(void) { int count; LCD_DELAY(200); for(count = 0; count < 4; count++) { LCD_WRITE_COMMAND(LCD_INIT_COMMAND); /* Write init command */ LCD_DELAY(20000); /* Wait */ } LCD_WRITE_COMMAND(LCD_INIT_COMMAND); LCD_DELAY(20000); LCD_WRITE_COMMAND(LCD_8BIT_2LINE_COMMAND); /* 8Bit, 2 Line */ LCD_DELAY(20000); /* Wait */ LCD_WRITE_COMMAND(LCD_OFF_COMMAND); /* Turn off LCD */ LCD_DELAY(20000); /* Wait */ LCD_WRITE_COMMAND(LCD_CLEAR_COMMAND); /* Clear LCD */ LCD_DELAY(20000); /* Wait */ LCD_WRITE_COMMAND(LCD_INCR_MODE_COMMAND); /* Set INCR mode */ LCD_DELAY(20000); /* Wait */ LCD_WRITE_COMMAND(LCD_ON_COMMAND); /* Turn on LCD */ LCD_DELAY(20000); /* Wait */}/********************************************************************************* sysLcdWriteString - write a string to the SBC ARM7 board LCD** This routine write given string to the SBC ARM7 LCD panel.** SEE ALSO: sysLcdInit(), sysLcdSetPos(), sysLcdWrite(), sysLcdClear().** RETURNS: OK oe ERROR*/STATUS sysLcdWriteString(char *string, char lineNumber, char columns){ char *ch; /* Set position */ if(sysLcdSetPos(lineNumber, columns) != OK) return(ERROR); ch = ((char *)(string)); /* Write string */ while(*ch != '\0') { LCD_DELAY(200); sysLcdWrite(*ch); ch++; } LCD_DELAY(200); return(OK);}/********************************************************************************* sysLcdWrite - writer character to the SBC ARM7 board LCD** This routine write a character to the SBC ARM7 LCD panel.** SEE ALSO: sysLcdInit(), sysLcdSetPos(), sysLcdClear(), sysLcdWriteString().** RETURNS: N/A*/void sysLcdWrite(char ch) { LCD_WRITE(ch); }/********************************************************************************* sysLcdSetPos - set the prompt position on the SBC ARM7 board LCD** This routine set the prompt position on the SBC ARM7 LCD panel.** SEE ALSO: sysLcdInit(), sysLcdClear(), sysLcdWrite(), sysLcdWriteString().** RETURNS: OK oe ERROR*/STATUS sysLcdSetPos(char line, char column) { char numOfShift = 0, val; /* Check if boundary is legal */ if(line < LCD_MIN_LINES || line > LCD_MAX_LINES || column < LCD_MIN_COLUMNS || column > LCD_MAX_COLUMNS) return(ERROR); numOfShift = (7-(line - 1)); val = ((LCD_LINE_POS_MASK << numOfShift) + (column - 1)); LCD_WRITE_COMMAND(val); /* Turn on LCD */ return(OK); }
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -