Fix my (incorrect) fix (with a good one I hope). Also reimplemented delayMult in the driver.
This commit is contained in:
@@ -96,6 +96,7 @@ char have_keypad = 0; // off by default
|
|||||||
char have_backlight = 0; // off by default
|
char have_backlight = 0; // off by default
|
||||||
char extIF = 0; // off by default
|
char extIF = 0; // off by default
|
||||||
char delayBus = 0; // Delay if the computer can send data too fast over
|
char delayBus = 0; // Delay if the computer can send data too fast over
|
||||||
|
int delayMult = 0; // Delay multiplier for slow displays
|
||||||
// its bus to LPT port
|
// its bus to LPT port
|
||||||
|
|
||||||
// These vars is not static, so it's accessable from
|
// These vars is not static, so it's accessable from
|
||||||
@@ -153,7 +154,6 @@ void HD44780_draw_frame (char *dat);
|
|||||||
char HD44780_getkey ();
|
char HD44780_getkey ();
|
||||||
|
|
||||||
void HD44780_position (int x, int y);
|
void HD44780_position (int x, int y);
|
||||||
//static void uPause (int delayCalls);
|
|
||||||
unsigned char HD44780_scankeypad();
|
unsigned char HD44780_scankeypad();
|
||||||
static int parse_span_list (int *spanListArray[], int *spLsize, int *dispOffsets[], int *dOffsize, int *dispSizeArray[], char *spanlist);
|
static int parse_span_list (int *spanListArray[], int *spLsize, int *dispOffsets[], int *dOffsize, int *dispSizeArray[], char *spanlist);
|
||||||
|
|
||||||
@@ -310,11 +310,11 @@ void
|
|||||||
common_init ()
|
common_init ()
|
||||||
{
|
{
|
||||||
hd44780_functions->senddata (0, RS_INSTR, ONOFFCTRL | DISPON | CURSOROFF | CURSORNOBLINK);
|
hd44780_functions->senddata (0, RS_INSTR, ONOFFCTRL | DISPON | CURSOROFF | CURSORNOBLINK);
|
||||||
hd44780_functions->uPause (40);
|
hd44780_functions->uPause (40*delayMult);
|
||||||
hd44780_functions->senddata (0, RS_INSTR, CLEAR);
|
hd44780_functions->senddata (0, RS_INSTR, CLEAR);
|
||||||
hd44780_functions->uPause (1600);
|
hd44780_functions->uPause (1600*delayMult);
|
||||||
hd44780_functions->senddata (0, RS_INSTR, HOMECURSOR);
|
hd44780_functions->senddata (0, RS_INSTR, HOMECURSOR);
|
||||||
hd44780_functions->uPause (1600);
|
hd44780_functions->uPause (1600*delayMult);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
@@ -350,7 +350,7 @@ HD44780_position (int x, int y)
|
|||||||
DDaddr += HD44780->wid;
|
DDaddr += HD44780->wid;
|
||||||
|
|
||||||
hd44780_functions->senddata (dispID, RS_INSTR, POSITION | DDaddr);
|
hd44780_functions->senddata (dispID, RS_INSTR, POSITION | DDaddr);
|
||||||
hd44780_functions->uPause (40); // Minimum exec time for all commands
|
hd44780_functions->uPause (40*delayMult); // Minimum exec time for all commands
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////
|
||||||
@@ -419,7 +419,7 @@ HD44780_flush_box (int lft, int top, int rgt, int bot)
|
|||||||
for (x = lft; x <= rgt; x++) {
|
for (x = lft; x <= rgt; x++) {
|
||||||
|
|
||||||
hd44780_functions->senddata (spanList[y], RS_DATA, HD44780->framebuf[(y * HD44780->wid) + x]);
|
hd44780_functions->senddata (spanList[y], RS_DATA, HD44780->framebuf[(y * HD44780->wid) + x]);
|
||||||
hd44780_functions->uPause (40); // Minimum exec time for all commands
|
hd44780_functions->uPause (40*delayMult); // Minimum exec time for all commands
|
||||||
}
|
}
|
||||||
//write(fd, HD44780->framebuf[(y*HD44780->wid)+lft, rgt-lft+1]);
|
//write(fd, HD44780->framebuf[(y*HD44780->wid)+lft, rgt-lft+1]);
|
||||||
}
|
}
|
||||||
@@ -685,7 +685,7 @@ HD44780_set_char (int n, char *dat)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
hd44780_functions->senddata (0, RS_INSTR, SETCHAR | n * 8);
|
hd44780_functions->senddata (0, RS_INSTR, SETCHAR | n * 8);
|
||||||
hd44780_functions->uPause (40); // Minimum exec time for all commands
|
hd44780_functions->uPause (40*delayMult); // Minimum exec time for all commands
|
||||||
|
|
||||||
for (row = 0; row < HD44780->cellhgt; row++) {
|
for (row = 0; row < HD44780->cellhgt; row++) {
|
||||||
letter = 0;
|
letter = 0;
|
||||||
@@ -694,7 +694,7 @@ HD44780_set_char (int n, char *dat)
|
|||||||
letter |= (dat[(row * HD44780->cellwid) + col] > 0);
|
letter |= (dat[(row * HD44780->cellwid) + col] > 0);
|
||||||
}
|
}
|
||||||
hd44780_functions->senddata (0, RS_DATA, letter);
|
hd44780_functions->senddata (0, RS_DATA, letter);
|
||||||
hd44780_functions->uPause (40); // Minimum exec time for all commands
|
hd44780_functions->uPause (40*delayMult); // Minimum exec time for all commands
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -769,7 +769,7 @@ HD44780_draw_frame (char *dat)
|
|||||||
HD44780_position(x,y);
|
HD44780_position(x,y);
|
||||||
}
|
}
|
||||||
hd44780_functions->senddata( spanList[y], RS_DATA, HD44780_charmap[(unsigned char)dat[(y * wid) + x]]);
|
hd44780_functions->senddata( spanList[y], RS_DATA, HD44780_charmap[(unsigned char)dat[(y * wid) + x]]);
|
||||||
hd44780_functions->uPause (40); // Minimum exec time for all commands
|
hd44780_functions->uPause (40*delayMult); // Minimum exec time for all commands
|
||||||
lcd_contents[(y*wid)+x] = dat[(y*wid)+x];
|
lcd_contents[(y*wid)+x] = dat[(y*wid)+x];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@@ -98,9 +98,9 @@ static inline void timing_uPause (int usecs) {
|
|||||||
delay_time.tv_nsec = remaining.tv_nsec;
|
delay_time.tv_nsec = remaining.tv_nsec;
|
||||||
}
|
}
|
||||||
#else // using I/O timing
|
#else // using I/O timing
|
||||||
// Assuming every port I/O takes 1ms, we'll do at least one.
|
// Assuming every port I/O takes 1us
|
||||||
int i=0;
|
for (int i=0; i < usecs; ++i)
|
||||||
do { port_in (port); } while (i++ < usecs/1000);
|
port_in(port);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user