diff options
-rw-r--r-- | drivers/tdisp/HD44780/tdisp_lld.c | 22 | ||||
-rw-r--r-- | include/tdisp/tdisp.h | 6 | ||||
-rw-r--r-- | releases.txt | 3 | ||||
-rw-r--r-- | src/tdisp/tdisp.c | 26 |
4 files changed, 33 insertions, 24 deletions
diff --git a/drivers/tdisp/HD44780/tdisp_lld.c b/drivers/tdisp/HD44780/tdisp_lld.c index 2e152977..2c28d8a3 100644 --- a/drivers/tdisp/HD44780/tdisp_lld.c +++ b/drivers/tdisp/HD44780/tdisp_lld.c @@ -85,6 +85,28 @@ bool_t TDISP_LLD(init)(void) { return TRUE; } +void TDISP_LLD(set_cursor)(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])); +} + +void TDISP_LLD(create_char)(uint8_t address, char *charmap) { + uint8_t i; + + /* make sure we don't write somewhere we're not supposed to */ + address &= TDISP_MAX_CUSTOM_CHARS; + + TDISP_LLD(write_cmd)(0x40 | (address << 3)); + + for(i = 0; i < 8; i++) { + TDISP_LLD(write_data)(charmap[i]); + } +} + #endif /* GFX_USE_TDISP */ /** @} */ diff --git a/include/tdisp/tdisp.h b/include/tdisp/tdisp.h index 88c560ce..c9a8f842 100644 --- a/include/tdisp/tdisp.h +++ b/include/tdisp/tdisp.h @@ -90,7 +90,7 @@ void tdispHome(void); * @param[in] col The column * @param[in] row The row */ -void tdispGotoXY(coord_t col, coord_t row); +void tdispSetCursor(coord_t col, coord_t row); /** * @brief Store a custom character in RAM @@ -98,10 +98,10 @@ void tdispGotoXY(coord_t col, coord_t row); * @note This usually must be done after each power-up since most * LCDs lose their RAM content. * - * @param[in] location On which address to store the character (from 0 up to max) + * @param[in] address On which address to store the character (from 0 up to max) * @param[in] charmap The character to be stored. */ -void tdispCreateChar(uint8_t location, char *charmap); +void tdispCreateChar(uint8_t address, char *charmap); /** * @brief Draws a single character at the current cursor position diff --git a/releases.txt b/releases.txt index 7ed1a17a..6433a812 100644 --- a/releases.txt +++ b/releases.txt @@ -4,6 +4,8 @@ current release: 1.5
FEATURE: Added ILI9325 driver - Thanks to Chris van Dongen aka _Sjaak
+FEATURE: Added TDISP module
+FIX: tdispGotoXY() renamed to tdispSetCursor()
*** changes after 1.4 ***
@@ -24,7 +26,6 @@ DEPRECATE: touchscreen deprecated - replaced with ginput functionality FEATURE: Numerous documentation improvements
FEATURE: Added a number of module demo and test programs
DEPRECATE: Remove of XPT2046 since full compatibility with ADS7843
-FEATURE: Introduced TDISP module
*** changes after 1.3 ***
diff --git a/src/tdisp/tdisp.c b/src/tdisp/tdisp.c index 22de001f..38fd56d8 100644 --- a/src/tdisp/tdisp.c +++ b/src/tdisp/tdisp.c @@ -78,26 +78,12 @@ void tdispHome(void) { TDISP_LLD(write_cmd)(0x02); } -void tdispCreateChar(uint8_t location, char *charmap) { - uint8_t i; - - /* make sure we don't write somewhere we're not supposed to */ - location &= TDISP_MAX_CUSTOM_CHARS; - - TDISP_LLD(write_cmd)(0x40 | (location << 3)); - - for(i = 0; i < 8; i++) { - TDISP_LLD(write_data)(charmap[i]); - } +void tdispCreateChar(uint8_t address, char *charmap) { + TDISP_LLD(create_char)(address, charmap); } -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])); +void tdispSetCursor(coord_t col, coord_t row) { + TDISP_LLD(set_cursor)(col, row); } void tdispDrawChar(char c) { @@ -110,12 +96,12 @@ void tdispDrawString(char *s) { } void tdispDrawCharLocation(coord_t col, coord_t row, char c) { - tdispGotoXY(col, row); + tdispSetCursor(col, row); tdispDrawChar(c); } void tdispDrawStringLocation(coord_t col, coord_t row, char *s) { - tdispGotoXY(col, row); + tdispSetCursor(col, row); tdispDrawString(s); } |