Corrected HD44780 to work with the curses driver.
This commit is contained in:
@@ -158,7 +158,7 @@ hd_init_4bit (HD44780_functions * hd44780_functions, lcd_logical_driver * driver
|
||||
|
||||
common_init ();
|
||||
|
||||
if (keypad) {
|
||||
if (have_keypad) {
|
||||
// Remember which input lines are stuck
|
||||
stuckinputs = lcdstat_HD44780_readkeypad (0);
|
||||
}
|
||||
|
||||
@@ -72,7 +72,6 @@ void shiftreg (unsigned char displayID, unsigned char r);
|
||||
#define EN2 32
|
||||
|
||||
static unsigned int lptPort;
|
||||
static char keypad;
|
||||
static char stuckinputs = 0; // if an input line is stuck, it will be ignored
|
||||
|
||||
static char lastkey = 0; // currently not in use, old keypad code
|
||||
@@ -92,7 +91,7 @@ hd_init_serialLpt (HD44780_functions * hd44780_functions, lcd_logical_driver * d
|
||||
hd44780_functions->senddata = lcdserLpt_HD44780_senddata;
|
||||
hd44780_functions->readkeypad = lcdserLpt_HD44780_readkeypad;
|
||||
|
||||
if (keypad) {
|
||||
if (have_keypad) {
|
||||
driver->getkey = lcdserLpt_HD44780_getkey;
|
||||
}
|
||||
// Clear the shiftregister
|
||||
|
||||
@@ -48,6 +48,8 @@
|
||||
#endif
|
||||
#include "port.h"
|
||||
|
||||
#define atest(i)
|
||||
|
||||
// Uncomment one of the lines below to select your desired delay generation
|
||||
// mechanism. If both defines are commented, the original I/O read timing
|
||||
// loop is used. Using DELAY_NANOSLEEP seems to provide the best performance.
|
||||
@@ -111,7 +113,7 @@ static int numDisplays = 0;
|
||||
static int *dispSizes = NULL;
|
||||
|
||||
// Keypad option
|
||||
char keypad = 0; // off by default
|
||||
char have_keypad = 0; // off by default
|
||||
// This var is not static, so it's accessable from all sub-drivers
|
||||
// Indeed, this should become cleaner... later...
|
||||
|
||||
@@ -246,7 +248,7 @@ HD44780_init (lcd_logical_driver * driver, char *args)
|
||||
}
|
||||
++i;
|
||||
} else if (strcmp (argv[i], "-k") == 0 || strcmp (argv[i], "--keypad") == 0) {
|
||||
keypad = 1;
|
||||
have_keypad = 1;
|
||||
printf( "HD44780 keypad extension enabled\n" );
|
||||
|
||||
} else if (0 == strcmp (argv[i], "-h") || 0 == strcmp (argv[i], "--help")) {
|
||||
@@ -303,6 +305,9 @@ HD44780_init (lcd_logical_driver * driver, char *args)
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
atest( port );
|
||||
|
||||
// Make sure the frame buffer is there...
|
||||
if (!HD44780->framebuf)
|
||||
HD44780->framebuf = (unsigned char *) malloc (HD44780->wid * HD44780->hgt);
|
||||
@@ -315,7 +320,7 @@ HD44780_init (lcd_logical_driver * driver, char *args)
|
||||
// These are the default HD44780 functions
|
||||
driver->clear = (void *) -1;
|
||||
driver->string = (void *) -1;
|
||||
driver->chr = (void *) -1;
|
||||
driver->chr = HD44780_chr;
|
||||
driver->vbar = HD44780_vbar;
|
||||
driver->init_vbar = HD44780_init_vbar;
|
||||
driver->hbar = HD44780_hbar;
|
||||
@@ -333,7 +338,7 @@ HD44780_init (lcd_logical_driver * driver, char *args)
|
||||
driver->icon = HD44780_icon;
|
||||
driver->draw_frame = HD44780_draw_frame;
|
||||
|
||||
if( keypad ) {
|
||||
if( have_keypad ) {
|
||||
driver->getkey = HD44780_getkey;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
#ifndef HD44780_H
|
||||
#define HD44780_H
|
||||
|
||||
extern char keypad; // non-zero if the keypad code is activated
|
||||
extern char have_keypad; // non-zero if the keypad code is activated
|
||||
|
||||
int HD44780_init (struct lcd_logical_driver *driver, char *args);
|
||||
/* The following methods can all be hidden. They are used through function ptrs
|
||||
|
||||
@@ -452,7 +452,7 @@ lcd_add_driver (char *driver, char *args)
|
||||
if ((add = lcd_allocate_driver()) == NULL)
|
||||
return -1;
|
||||
|
||||
memset (add, 0, sizeof (add));
|
||||
memset (add, 0, sizeof (lcd_logical_driver));
|
||||
|
||||
// Default settings for the driver...
|
||||
lcd_drv_init(add, NULL);
|
||||
|
||||
Reference in New Issue
Block a user