diff options
-rw-r--r-- | include/tdisp/tdisp.h | 11 | ||||
-rw-r--r-- | src/tdisp/tdisp.c | 20 |
2 files changed, 24 insertions, 7 deletions
diff --git a/include/tdisp/tdisp.h b/include/tdisp/tdisp.h index 4641b269..58de7af2 100644 --- a/include/tdisp/tdisp.h +++ b/include/tdisp/tdisp.h @@ -45,11 +45,12 @@ * @name TDISP display attributes * @{ */ -#define TDISP_ON 0x01 -#define TDISP_OFF 0x02 -#define TDISP_CURSOR_ON 0x03 -#define TDISP_CURSOR_OFF 0x04 -#define TDISP_CURSOR_BLINK 0x05 +#define TDISP_ON 0x01 +#define TDISP_OFF 0x02 +#define TDISP_CURSOR_ON 0x03 +#define TDISP_CURSOR_OFF 0x04 +#define TDISP_CURSOR_BLINK_ON 0x05 +#define TDISP_CURSOR_BLINK_OFF 0x06 /** @} */ /** diff --git a/src/tdisp/tdisp.c b/src/tdisp/tdisp.c index 807dd026..121ebcf5 100644 --- a/src/tdisp/tdisp.c +++ b/src/tdisp/tdisp.c @@ -31,10 +31,12 @@ #if GFX_USE_TDISP || defined(__DOXYGEN__) +static uint8_t _displaycontrol; + bool_t tdispInit(void) { bool_t ret; - ret = TDISP_LLD(init)(); + ret = TDIP_LLD(init)(); return ret; } @@ -42,14 +44,28 @@ bool_t tdispInit(void) { 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: + case TDISP_CURSOR_BLINK_OFF: + _displaycontrol &=~ 0x00; + TDISP_LLD(write_cmd)(0x08 | _displaycontrol); break; } } |