From 7d1dcb0d086bde5bb56544464c91e0105a990276 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Thu, 17 Jan 2013 09:16:59 +0100 Subject: [PATCH] TDISP cleanup --- drivers/tdisp/HD44780/tdisp_lld.c | 33 +++++++++++++++++++++++++++++++ include/tdisp/lld/tdisp_lld.h | 1 + include/tdisp/tdisp.h | 9 +++++---- src/tdisp/tdisp.c | 29 ++------------------------- 4 files changed, 41 insertions(+), 31 deletions(-) diff --git a/drivers/tdisp/HD44780/tdisp_lld.c b/drivers/tdisp/HD44780/tdisp_lld.c index c150c870..d0f4af0d 100644 --- a/drivers/tdisp/HD44780/tdisp_lld.c +++ b/drivers/tdisp/HD44780/tdisp_lld.c @@ -115,6 +115,39 @@ void tdisp_lld_home(void) { tdisp_lld_write_cmd(0x02); } +void tdisp_lld_control(uint16_t what, void *value) { + (void)what; + (void)value; +/* + switch(attributes) { + case TDISP_ON: + _displaycontrol |= 0x04; + tdisp_lld_write_cmd(0x08 | _displaycontrol); + break; + case TDISP_OFF: + _displaycontrol &=~ 0x04; + tdisp_lld_write_cmd(0x08 | _displaycontrol); + break; + case TDISP_CURSOR_ON: + _displaycontrol |= 0x02; + tdisp_lld_write_cmd(0x08 | _displaycontrol); + break; + case TDISP_CURSOR_OFF: + _displaycontrol &=~ 0x02; + tdisp_lld_write_cmd(0x08 | _displaycontrol); + break; + case TDISP_CURSOR_BLINK_ON: + _displaycontrol |= 0x00; + tdisp_lld_write_cmd(0x08 | _displaycontrol); + break; + case TDISP_CURSOR_BLINK_OFF: + _displaycontrol &=~ 0x00; + tdisp_lld_write_cmd(0x08 | _displaycontrol); + break; + } +*/ +} + #endif /* GFX_USE_TDISP */ /** @} */ diff --git a/include/tdisp/lld/tdisp_lld.h b/include/tdisp/lld/tdisp_lld.h index 891b7b98..de6266f3 100644 --- a/include/tdisp/lld/tdisp_lld.h +++ b/include/tdisp/lld/tdisp_lld.h @@ -44,6 +44,7 @@ extern void tdisp_lld_set_cursor(coord_t col, coord_t row); extern void tdisp_lld_create_char(uint8_t address, char *charmap); extern void tdisp_lld_clear(void); extern void tdisp_lld_home(void); +extern void tdisp_lld_control(uint16_t what, void *value); #ifdef __cplusplus } diff --git a/include/tdisp/tdisp.h b/include/tdisp/tdisp.h index c9a8f842..01cb76a0 100644 --- a/include/tdisp/tdisp.h +++ b/include/tdisp/tdisp.h @@ -67,12 +67,13 @@ bool_t tdispInit(void); /** * @brief Control different display properties - * @note Multiple attributes can be passed using the OR operator. - * @note Example: tdispSetAttributes(TDISP_DISPLAY_ON | TDISP_CURSOR_BLINK) + * @note A wrapper macro exists for each option, please use them + * instead of this function manually. * - * @param[in] attributes The attributes + * @param[in] what What you want to control + * @param[in] value The value to be assigned */ -void tdispSetAttributes(uint8_t attributes); +void tdispControl(uint16_t what, void *value); /** * @brief Clears the display diff --git a/src/tdisp/tdisp.c b/src/tdisp/tdisp.c index 8a2c501a..3556e031 100644 --- a/src/tdisp/tdisp.c +++ b/src/tdisp/tdisp.c @@ -41,33 +41,8 @@ bool_t tdispInit(void) { return ret; } -void tdispSetAttributes(uint8_t attributes) { - switch(attributes) { - case TDISP_ON: - _displaycontrol |= 0x04; - tdisp_lld_write_cmd(0x08 | _displaycontrol); - break; - case TDISP_OFF: - _displaycontrol &=~ 0x04; - tdisp_lld_write_cmd(0x08 | _displaycontrol); - break; - case TDISP_CURSOR_ON: - _displaycontrol |= 0x02; - tdisp_lld_write_cmd(0x08 | _displaycontrol); - break; - case TDISP_CURSOR_OFF: - _displaycontrol &=~ 0x02; - tdisp_lld_write_cmd(0x08 | _displaycontrol); - break; - case TDISP_CURSOR_BLINK_ON: - _displaycontrol |= 0x00; - tdisp_lld_write_cmd(0x08 | _displaycontrol); - break; - case TDISP_CURSOR_BLINK_OFF: - _displaycontrol &=~ 0x00; - tdisp_lld_write_cmd(0x08 | _displaycontrol); - break; - } +void tdispControl(uint16_t what, void *value) { + tdisp_lld_control(what, value); } void tdispClear(void) {