diff options
author | Joel Bodenmann <joel@unormal.org> | 2013-01-10 15:03:34 +0100 |
---|---|---|
committer | Joel Bodenmann <joel@unormal.org> | 2013-01-10 15:03:34 +0100 |
commit | 77a93bb43d373a59df9da29053b9e64b4b3cf474 (patch) | |
tree | 037e8a4f6e8757f2a75d64a62f8725de94085f69 | |
parent | d5e7afe756fe4c19dd9360baed23599b268709af (diff) | |
download | uGFX-77a93bb43d373a59df9da29053b9e64b4b3cf474.tar.gz uGFX-77a93bb43d373a59df9da29053b9e64b4b3cf474.tar.bz2 uGFX-77a93bb43d373a59df9da29053b9e64b4b3cf474.zip |
TDISP update
-rw-r--r-- | drivers/tdisp/HD44780/tdisp_lld.c | 7 | ||||
-rw-r--r-- | include/tdisp/tdisp.h | 7 | ||||
-rw-r--r-- | src/tdisp/tdisp.c | 5 |
3 files changed, 11 insertions, 8 deletions
diff --git a/drivers/tdisp/HD44780/tdisp_lld.c b/drivers/tdisp/HD44780/tdisp_lld.c index 9644eaa8..2e152977 100644 --- a/drivers/tdisp/HD44780/tdisp_lld.c +++ b/drivers/tdisp/HD44780/tdisp_lld.c @@ -32,13 +32,6 @@ #if GFX_USE_TDISP /*|| defined(__DOXYGEN__)*/ -#ifndef TDISP_ROWS - #define TDISP_ROWS 16 -#endif -#ifndef TDISP_COLUMNS - #define TDISP_COLUMNS 2 -#endif - #include "tdisp_lld_board_example.h" static void _writeData(uint8_t data) { diff --git a/include/tdisp/tdisp.h b/include/tdisp/tdisp.h index aa577f88..619a6bab 100644 --- a/include/tdisp/tdisp.h +++ b/include/tdisp/tdisp.h @@ -41,6 +41,13 @@ /* Include the low level driver information */ #include "tdisp/lld/tdisp_lld.h" +#ifndef TDISP_ROWS + #define TDISP_ROWS 2 +#endif +#ifndef TDISP_COLUMNS + #define TDISP_COLUMNS 16 +#endif + #ifndef TDISP_NEED_4BIT_MODE #define TDISP_NEED_4BIT_MODE FALSE #endif diff --git a/src/tdisp/tdisp.c b/src/tdisp/tdisp.c index a6e5e2f5..edd5b423 100644 --- a/src/tdisp/tdisp.c +++ b/src/tdisp/tdisp.c @@ -50,6 +50,9 @@ void tdispHome(void) { void tdispGotoXY(coord_t col, coord_t row) { uint8_t row_offsets[] = { 0x00, 0x40, 0x14, 0x54 }; + if(row >= TDISP_ROWS) + row = TDISP_ROWS - 1; + TDISP_LLD(write_cmd)(0x80 | (col + row_offsets[row])); } @@ -60,7 +63,7 @@ void tdispDrawChar(char c) { void tdispDrawString(char *s) { char c; - while(c = s++) + while(c = *s++) tdispDrawChar(c); } |