Browse Source

fixed wrong offset when using 16x4 displays

pull/3/head
root 12 years ago
parent
commit
b1b1dbe5ce
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      wiringPi/lcd.c

+ 10
- 1
wiringPi/lcd.c View File

@@ -180,9 +180,18 @@ void lcdClear (int fd)

void lcdPosition (int fd, int x, int y)
{
static uint8_t rowOff [4] = { 0x00, 0x40, 0x14, 0x54 } ;
static uint8_t rowOff [4] ;
struct lcdDataStruct *lcd = lcds [fd] ;

if (lcd->rows == 4 && lcd->cols == 16)
{
rowOff[0] = 0x00; rowOff[1] = 0x40; rowOff[2] = 0x10; rowOff[3] = 0x50;
}
else
{
rowOff[0] = 0x00; rowOff[1] = 0x40; rowOff[2] = 0x14; rowOff[3] = 0x54;
}

putCommand (lcd, x + (LCD_DGRAM | rowOff [y])) ;
}



Loading…
Cancel
Save