From: marco Date: Wed, 20 Sep 2006 19:55:01 +0000 (+0000) Subject: Added CONFIG_LCD_4BIT. X-Git-Tag: 1.0.0~521 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=a341bd955d2b5a9eed4a77f3a341bc4eef476d51;p=bertos.git Added CONFIG_LCD_4BIT. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@720 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/app/demo/appconfig.h b/app/demo/appconfig.h index f1ff38fb..d46212dd 100755 --- a/app/demo/appconfig.h +++ b/app/demo/appconfig.h @@ -46,6 +46,9 @@ /*#* *#* $Log$ + *#* Revision 1.5 2006/09/20 19:55:01 marco + *#* Added CONFIG_LCD_4BIT. + *#* *#* Revision 1.4 2006/09/13 18:29:22 bernie *#* Add a few missing CONFIG_ definitions. *#* @@ -225,4 +228,7 @@ /// Accept input implicitly after this amount of time. #define CONFIG_LEVELEDIT_TIMEOUT 3000 /* ms */ +/// LCD bus size. If 0 use 8bit bus. +#define CONFIG_LCD_4BIT 0 + #endif /* APPCONFIG_H */ diff --git a/drv/lcd_hd44.c b/drv/lcd_hd44.c index de7bdf7a..0bd7b344 100755 --- a/drv/lcd_hd44.c +++ b/drv/lcd_hd44.c @@ -14,6 +14,9 @@ /*#* *#* $Log$ + *#* Revision 1.3 2006/09/20 19:55:01 marco + *#* Added CONFIG_LCD_4BIT. + *#* *#* Revision 1.2 2006/07/19 12:56:25 bernie *#* Convert to new Doxygen style. *#* @@ -37,18 +40,10 @@ *#*/ #include "lcd_hd44.h" -#include "lcd_bus_pz.h" -#include +#include "hw_lcd.h" +#include #include -#if defined(LCD_READ_H) && defined(LCD_READ_L) && defined(LCD_WRITE_H) && defined(LCD_WRITE_L) - #define CONFIG_LCD_4BIT 1 -#elif defined(LCD_READ) && defined(LCD_WRITE) - #define CONFIG_LCD_4BIT 0 -#else - #error Incomplete or missing LCD_READ/LCD_WRITE macros -#endif - /** Flag di stato del display */ #define LCDF_BUSY BV(7) @@ -184,7 +179,7 @@ INLINE uint8_t lcd_dataRead(void) /* Read data */ LCD_SET_E; LCD_DELAY_READ; - data |= LCD_READ; + data = LCD_READ; LCD_CLR_E; LCD_DELAY_READ; @@ -391,8 +386,9 @@ void lcd_hw_init(void) lcd_regWrite(LCD_CMD_CLEAR); timer_delay(2); - //lcd_regWrite(LCD_CMD_RESET_DDRAM); 4 bit mode doesn't allow char reprogramming - +#if !CONFIG_LCD_4BIT + lcd_regWrite(LCD_CMD_RESET_DDRAM); // 4 bit mode doesn't allow char reprogramming +#endif lcd_regWrite(LCD_CMD_DISPLAYMODE); timer_delay(2); } diff --git a/drv/lcd_hd44.h b/drv/lcd_hd44.h index 9a0d4b12..bcab214e 100755 --- a/drv/lcd_hd44.h +++ b/drv/lcd_hd44.h @@ -14,6 +14,9 @@ /*#* *#* $Log$ + *#* Revision 1.3 2006/09/20 19:55:01 marco + *#* Added CONFIG_LCD_4BIT. + *#* *#* Revision 1.2 2006/07/19 12:56:25 bernie *#* Convert to new Doxygen style. *#* @@ -39,6 +42,7 @@ #ifndef DRV_LCD_HD44_H #define DRV_LCD_HD44_H +#include #include /* For stdint types */ /** @@ -54,8 +58,13 @@ * \{ */ #define LCD_CMD_DISPLAY_INI 0x30 -//#define LCD_CMD_SETFUNC 0x38 /**< 8 bits, 2 lines, 5x7 dots */ -#define LCD_CMD_SETFUNC 0x28 /**< 4 bits, 2 lines, 5x7 dots */ + +#if CONFIG_LCD_4BIT + #define LCD_CMD_SETFUNC 0x28 /**< 4 bits, 2 lines, 5x7 dots */ +#else + #define LCD_CMD_SETFUNC 0x38 /**< 8 bits, 2 lines, 5x7 dots */ +#endif + #define LCD_CMD_DISPLAY_ON 0x0F /**< Switch on display */ #define LCD_CMD_DISPLAY_OFF 0x08 /**< Switch off display */ #define LCD_CMD_CLEAR 0x01 /**< Clear display */