Amend lcd_goto() to be safe and not move cursor outside of screen limits and add screen positions definitions
This commit is contained in:
parent
0825cd2f44
commit
2f5451d76e
@ -7,6 +7,8 @@ Version: 1.11
|
||||
#include <avr/pgmspace.h>
|
||||
#include <avr/sfr_defs.h>
|
||||
#include <inttypes.h>
|
||||
#define __ASSERT_USE_STDERR
|
||||
#include <assert.h>
|
||||
#include "hd44780.h"
|
||||
#include "hd44780_settings.h"
|
||||
|
||||
@ -495,6 +497,8 @@ Returns: none
|
||||
*************************************************************************/
|
||||
void lcd_goto(uint8_t pos)
|
||||
{
|
||||
//Do not go outside of screen limits
|
||||
assert(pos < LCD_COLS_MAX);
|
||||
lcd_command((1<<LCD_DDRAM)+pos);
|
||||
}
|
||||
|
||||
|
@ -36,6 +36,14 @@ Version: 1.11
|
||||
|
||||
#define LCD_BUSY 7 // DB7: LCD is busy
|
||||
|
||||
// LCD columns and rows definitions
|
||||
#define LCD_ROW_1 0
|
||||
#define LCD_ROW_2 64
|
||||
#define LCD_COLS_MAX 128
|
||||
|
||||
// Maximum character what can be displayed with 1 byte
|
||||
#define MAX_CARACTER 255
|
||||
|
||||
|
||||
void lcd_init();
|
||||
void lcd_command(uint8_t cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user