add set position function for lcd

This commit is contained in:
2021-05-21 02:45:25 +02:00
parent 1fc729f8ce
commit 5866c1f6f0
2 changed files with 48 additions and 30 deletions

18
lcd.c
View File

@@ -44,6 +44,22 @@ void lcd_nibble_out(unsigned char c, unsigned char cd) {
lcd_out(out | rs );
}
void lcd_set_position(uint8_t row, uint8_t col){
if(col >= LCD_WIDTH)
return;
if(row==0)
lcd_nibble_out(0x80|col, 0);
if(row==1)
lcd_nibble_out(0xC0|col, 0);
if(row==2)
lcd_nibble_out(0x80|(col+LCD_WIDTH), 0);
if(row==3)
lcd_nibble_out(0xC0|(col+LCD_WIDTH), 0);
char_counter = (row * LCD_WIDTH) + col;
}
//***************************************************************************************
// clear LCD
void lcd_clear() {
@@ -184,4 +200,4 @@ void lcd_write_P (const char *Buffer,...)
}
}
va_end(ap);
}
}