TDISP fixes

ugfx_release_2.6
Joel Bodenmann 2013-05-15 18:00:42 +02:00
parent 4ba223030d
commit 11a71cb080
4 changed files with 341 additions and 325 deletions

View File

@ -112,7 +112,7 @@ bool_t tdisp_lld_init(void) {
// write_cmd(0x38);
// chThdSleepMilliseconds(64);
//
// displaycontrol = DISPLAY_ON | CURSOR_ON | CURSOR_BLINK; // The default displaycontrol
// displaycontrol = TDISP_DISPLAY_ON | TDISP_CURSOR_ON | TDISP_CURSOR_BLINK; // The default displaycontrol
// write_cmd(0x08 | displaycontrol);
// chThdSleepMicroseconds(50);
//
@ -171,26 +171,26 @@ void tdisp_lld_control(uint16_t what, uint16_t value) {
switch(what) {
case TDISP_CTRL_BACKLIGHT:
if ((uint8_t)value)
displaycontrol |= DISPLAY_ON;
displaycontrol |= TDISP_DISPLAY_ON;
else
displaycontrol &= ~DISPLAY_ON;
displaycontrol &= ~TDISP_DISPLAY_ON;
write_cmd(0x08 | displaycontrol);
break;
case TDISP_CTRL_CURSOR:
switch((uint8_t)value) {
case cursorOff:
displaycontrol &= ~CURSOR_ON;
displaycontrol &= ~TDISP_CURSOR_ON;
break;
case cursorBlock:
case cursorUnderline:
case cursorBar:
displaycontrol = (displaycontrol | CURSOR_ON) & ~CURSOR_BLINK;
displaycontrol = (displaycontrol | TDISP_CURSOR_ON) & ~TDISP_CURSOR_BLINK;
break;
case cursorBlinkingBlock:
case cursorBlinkingUnderline:
case cursorBlinkingBar:
default:
displaycontrol |= (CURSOR_ON | CURSOR_BLINK);
displaycontrol |= (TDISP_CURSOR_ON | TDISP_CURSOR_BLINK);
break;
}
write_cmd(0x08 | displaycontrol);

View File

@ -129,6 +129,17 @@ void tdispDrawChar(char c);
*/
void tdispDrawString(char *s);
/**
* @brief Draws a string at a specific position
*
* @param[in] col The column (x)
* @param[in] row The row (y)
* @param[in] s The string to be drawin
*
* @note The cursor position after this call is not the same as before.
*/
void tdispDrawStringLocation(coord_t col, coord_t row, char *s);
/**
* @brief Control different display properties
* @note A wrapper macro exists for each option, please use them

View File

@ -94,6 +94,11 @@ void tdispDrawString(char *s) {
MUTEX_LEAVE();
}
void tdispDrawStringLocation(coord_t col, coord_t row, char *s) {
tdispSetCursor(col, row);
tdispSDrawString(s);
}
void tdispControl(uint16_t what, void *value) {
MUTEX_ENTER();
tdisp_lld_control(what, value);