From 2f5451d76eebb39c0255c496e6eea60a2fda4ae1 Mon Sep 17 00:00:00 2001 From: Silver Kits Date: Tue, 4 Oct 2016 22:00:20 +0300 Subject: [PATCH] Amend lcd_goto() to be safe and not move cursor outside of screen limits and add screen positions definitions --- lib/hd44780_111/hd44780.c | 4 ++++ lib/hd44780_111/hd44780.h | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/hd44780_111/hd44780.c b/lib/hd44780_111/hd44780.c index d0db4bd..d00deae 100755 --- a/lib/hd44780_111/hd44780.c +++ b/lib/hd44780_111/hd44780.c @@ -7,6 +7,8 @@ Version: 1.11 #include #include #include +#define __ASSERT_USE_STDERR +#include #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<