- coding style harmonization
- check onsistency between Size & vSpan
This commit is contained in:
@@ -75,9 +75,9 @@
|
||||
// HD44780_senddata
|
||||
// HD44780_readkeypad
|
||||
|
||||
void lcdwinamp_HD44780_senddata (PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch);
|
||||
void lcdwinamp_HD44780_backlight (PrivateData *p, unsigned char state);
|
||||
unsigned char lcdwinamp_HD44780_readkeypad (PrivateData *p, unsigned int YData);
|
||||
void lcdwinamp_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch);
|
||||
void lcdwinamp_HD44780_backlight(PrivateData *p, unsigned char state);
|
||||
unsigned char lcdwinamp_HD44780_readkeypad(PrivateData *p, unsigned int YData);
|
||||
void lcdwinamp_HD44780_output(PrivateData *p, int data);
|
||||
|
||||
#define EN1 STRB
|
||||
@@ -92,7 +92,7 @@ static const unsigned char EnMask[] = { EN1, EN2, EN3 };
|
||||
|
||||
// initialise the driver
|
||||
int
|
||||
hd_init_winamp (Driver *drvthis)
|
||||
hd_init_winamp(Driver *drvthis)
|
||||
{
|
||||
PrivateData *p = (PrivateData*) drvthis->private_data;
|
||||
HD44780_functions *hd44780_functions = p->hd44780_functions;
|
||||
@@ -105,16 +105,16 @@ hd_init_winamp (Driver *drvthis)
|
||||
hd44780_functions->readkeypad = lcdwinamp_HD44780_readkeypad;
|
||||
|
||||
// setup the lcd in 8 bit mode
|
||||
hd44780_functions->senddata (p, 0, RS_INSTR, FUNCSET | IF_8BIT);
|
||||
hd44780_functions->uPause (p, 4100);
|
||||
hd44780_functions->senddata (p, 0, RS_INSTR, FUNCSET | IF_8BIT);
|
||||
hd44780_functions->uPause (p, 100);
|
||||
hd44780_functions->senddata(p, 0, RS_INSTR, FUNCSET | IF_8BIT);
|
||||
hd44780_functions->uPause(p, 4100);
|
||||
hd44780_functions->senddata(p, 0, RS_INSTR, FUNCSET | IF_8BIT);
|
||||
hd44780_functions->uPause(p, 100);
|
||||
|
||||
common_init (p, IF_8BIT);
|
||||
common_init(p, IF_8BIT);
|
||||
|
||||
if (p->have_keypad) {
|
||||
// Remember which input lines are stuck
|
||||
p->stuckinputs = lcdwinamp_HD44780_readkeypad (p, 0);
|
||||
p->stuckinputs = lcdwinamp_HD44780_readkeypad(p, 0);
|
||||
}
|
||||
|
||||
// Write new value to output port latches
|
||||
@@ -125,7 +125,7 @@ hd_init_winamp (Driver *drvthis)
|
||||
|
||||
// lcdwinamp_HD44780_senddata
|
||||
void
|
||||
lcdwinamp_HD44780_senddata (PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch)
|
||||
lcdwinamp_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch)
|
||||
{
|
||||
unsigned char enableLines = 0, portControl;
|
||||
|
||||
@@ -144,17 +144,17 @@ lcdwinamp_HD44780_senddata (PrivateData *p, unsigned char displayID, unsigned ch
|
||||
enableLines = EnMask[displayID - 1];
|
||||
|
||||
// 40 nS setup time for RS valid to EN high, so set RS
|
||||
port_out (p->port + 2, portControl ^ OUTMASK);
|
||||
port_out(p->port + 2, portControl ^ OUTMASK);
|
||||
|
||||
// Output the actual data
|
||||
port_out (p->port, ch);
|
||||
port_out(p->port, ch);
|
||||
|
||||
if ( p->delayBus ) p->hd44780_functions->uPause (p, 1);
|
||||
if (p->delayBus) p->hd44780_functions->uPause(p, 1);
|
||||
|
||||
// then set EN high
|
||||
port_out (p->port + 2, (enableLines|portControl) ^ OUTMASK);
|
||||
port_out(p->port + 2, (enableLines|portControl) ^ OUTMASK);
|
||||
|
||||
if ( p->delayBus ) p->hd44780_functions->uPause (p, 1);
|
||||
if (p->delayBus) p->hd44780_functions->uPause(p, 1);
|
||||
|
||||
// 80 nS setup from valid data to EN low will be met without any delay
|
||||
// unless you are running a REALLY FAST ISA bus (like 75 MHZ!)
|
||||
@@ -163,30 +163,30 @@ lcdwinamp_HD44780_senddata (PrivateData *p, unsigned char displayID, unsigned ch
|
||||
// ABOVE TEXT ignored now, using delays if delayBus is specified
|
||||
|
||||
// Set EN low and we're done...
|
||||
port_out (p->port + 2, portControl ^ OUTMASK);
|
||||
port_out(p->port + 2, portControl ^ OUTMASK);
|
||||
|
||||
// 10 nS data hold time provided by the length of ISA write for EN
|
||||
}
|
||||
|
||||
void lcdwinamp_HD44780_backlight (PrivateData *p, unsigned char state)
|
||||
void lcdwinamp_HD44780_backlight(PrivateData *p, unsigned char state)
|
||||
{
|
||||
p->backlight_bit = (state?0:nSEL);
|
||||
|
||||
port_out (p->port + 2, p->backlight_bit ^ OUTMASK);
|
||||
port_out(p->port + 2, p->backlight_bit ^ OUTMASK);
|
||||
}
|
||||
|
||||
unsigned char lcdwinamp_HD44780_readkeypad (PrivateData *p, unsigned int YData)
|
||||
unsigned char lcdwinamp_HD44780_readkeypad(PrivateData *p, unsigned int YData)
|
||||
{
|
||||
unsigned char readval;
|
||||
|
||||
// 8 bits output
|
||||
// Convert the positive logic to the negative logic on the LPT port
|
||||
port_out (p->port, ~YData & 0x00FF );
|
||||
port_out(p->port, ~YData & 0x00FF);
|
||||
|
||||
if ( p->delayBus ) p->hd44780_functions->uPause (p, 1);
|
||||
if (p->delayBus) p->hd44780_functions->uPause(p, 1);
|
||||
|
||||
// Read inputs
|
||||
readval = ~ port_in (p->port + 1) ^ INMASK;
|
||||
readval = ~ port_in(p->port + 1) ^ INMASK;
|
||||
|
||||
// And convert value back (MSB first).
|
||||
return (((readval & FAULT) / FAULT <<4) | /* pin 15 */
|
||||
@@ -201,8 +201,8 @@ void lcdwinamp_HD44780_output(PrivateData *p, int data)
|
||||
// Setup data bus
|
||||
port_out(p->port, data);
|
||||
// Strobe the latch (374 latches on rising edge, 3/574 on trailing. No matter)
|
||||
port_out (p->port + 2, (LE | p->backlight_bit) ^ OUTMASK);
|
||||
if ( p->delayBus ) p->hd44780_functions->uPause (p, 1);
|
||||
port_out (p->port + 2, (p->backlight_bit) ^ OUTMASK);
|
||||
if ( p->delayBus ) p->hd44780_functions->uPause (p, 1);
|
||||
port_out(p->port + 2, (LE | p->backlight_bit) ^ OUTMASK);
|
||||
if (p->delayBus) p->hd44780_functions->uPause(p, 1);
|
||||
port_out(p->port + 2, (p->backlight_bit) ^ OUTMASK);
|
||||
if (p->delayBus) p->hd44780_functions->uPause(p, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user