From: johanknol Date: Fri, 2 Feb 2001 15:29:17 +0000 (+0000) Subject: moved lcd to tinibios library support X-Git-Url: https://git.gag.com/?a=commitdiff_plain;h=4be33f246fc44f05c29edc00b43a27d02ea30bd8;p=fw%2Fsdcc moved lcd to tinibios library support git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@561 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- diff --git a/device/examples/ds390/clock390/lcd.c b/device/examples/ds390/clock390/lcd.c deleted file mode 100644 index a6b05ef5..00000000 --- a/device/examples/ds390/clock390/lcd.c +++ /dev/null @@ -1,174 +0,0 @@ -#define LCD_ROWS 4 -#define LCD_COLLUMNS 20 - -xdata at 0x380002 static unsigned char lcdIwr; -xdata at 0x38000a static unsigned char lcdDwr; - -#ifdef LCD_RW - -xdata at 0x380003 static unsigned char lcdIrd; -xdata at 0x38000b static unsigned char lcdDrd; - -#define LcdWait { while (lcdIrd&0x80) ; } - -#else //#ifdef LCD_RW - -// wait for 100us*time -// check this, _PLEASE_ - -static void Wait100u(long time) { - register long timeout=time*50; - while (timeout--) - ; -} - -#define LcdWait { Wait100u(1);} - -#endif //#ifdef LCD_RW - -// set the dd ram addresses for the rows -// this one is for a 20x4 LCD -xdata static unsigned char lcdLinesStart[LCD_ROWS]={0, 0x40, 0x14, 0x54}; - -#include -#include -#include -#include -#include "lcd.h" - -void LcdInit() { - - Wait100u(150); // >15 ms - - lcdIwr=0x38 ; - Wait100u(50); // >4.1 ms - - lcdIwr=0x38; - Wait100u(1); // >100 us - - lcdIwr=0x38; - Wait100u(1); // >100 u - - lcdIwr=0x38; // interface 8 bit - Wait100u(1); // >40u - - lcdIwr=0x0c; // display on - Wait100u(1); // >40u - LcdClear(); - Wait100u(1); // >40u -} - -void LcdOn() { - lcdIwr=0x0c; // display on - LcdWait; -} - -void LcdOff() { - lcdIwr=0x08; // display off - LcdWait; -} - -void LcdCursorOn() { - // TODO -} - -void LcdCursorOff() { - // TODO -} - -void LcdScrollOn() { - // TODO -} - -void LcdScrollOff() { - // TODO -} - -void LcdCharDefine() { - // TODO -} - -void LcdClear() { - lcdIwr=0x01; // display clear - Wait100u(50); -} - -void LcdHome() { - lcdIwr=0x80; // set dd ram address 0 - LcdWait; -} - -void LcdGoto(unsigned int collumnRow) { // msb=collumn, lsb=row - lcdIwr=0x80 + \ - lcdLinesStart[collumnRow&0xff] + \ - (collumnRow>>8); - LcdWait; -} - -void LcdPutChar(char c) { - lcdDwr=c; - LcdWait; -} - -void LcdPutString (char *string) { - char c; - while (c=*string++) { - LcdPutChar (c); - } -} - -void LcdLPutString (unsigned int collumnRow, char *string) { - LcdGoto(collumnRow); - LcdPutString(string); -} - -// let's hope that no one ever printf's more than the display width, -// however they will :), so to be sure -xdata static char lcdPrintfBuffer[LCD_COLLUMNS*4]; - -void LcdPrintf (xdata const char *format, ...) reentrant { - va_list arg; - - va_start (arg, format); - vsprintf (lcdPrintfBuffer, format, arg); - - LcdPutString(lcdPrintfBuffer); - - va_end (arg); -} - -void LcdLPrintf (unsigned int collumnRow, xdata const char *format, ...) reentrant { - va_list arg; - - LcdGoto(collumnRow); - - // we can not just call LcdPrintf since we have no idea what is on the stack, - // so we have to do it all over again - va_start (arg, format); - vsprintf (lcdPrintfBuffer, format, arg); - - LcdPutString(lcdPrintfBuffer); - - va_end (arg); -} - -#if 0 -// These don't belong here -void LedOn (void) { - _asm - setb P3.5 - _endasm; -} - -void LedOff (void) { - _asm - clr P3.5 - _endasm; -} - -void LedToggle (void) { - _asm - cpl P3.5 - _endasm; -} -#endif diff --git a/device/examples/ds390/clock390/lcd.h b/device/examples/ds390/clock390/lcd.h deleted file mode 100644 index b0543328..00000000 --- a/device/examples/ds390/clock390/lcd.h +++ /dev/null @@ -1,16 +0,0 @@ -extern void LcdInit(void); -extern void LcdOn(void); -extern void LcdOff(void); -extern void LcdClear(void); -extern void LcdHome(void); -extern void LcdGoto(unsigned int collumnRow); -extern void LcdPutChar(char c); -extern void LcdPutString(char *string); -extern void LcdLPutString(unsigned int collumnRow, char *string); -extern void LcdPrintf(xdata const char *format, ...) reentrant; -extern void LcdLPrintf(unsigned int collumnRow, xdata const char *format, ...) reentrant; - -// These don't belong here -extern void LedOn (void); -extern void LedOff (void); -extern void LedToggle (void);