
Clone of the "Keyboard" project combined with string>LCD calls and Serial reading for the STM32F746G-DISCO. Screen has to be reset and the font set again, and Serial must be created and destroyed each time, to dodge apparent F7 lower-level issues. Keyboard can print prompt.
Dependencies: BSP_DISCO_F746NG mbed
Fork of Keyboard by
Diff: user/keyboard.c
- Revision:
- 4:0e5755618652
- Parent:
- 0:3ea368f65bca
--- a/user/keyboard.c Wed Feb 15 20:29:17 2017 +0000 +++ b/user/keyboard.c Fri Feb 17 18:29:25 2017 +0000 @@ -400,7 +400,7 @@ } /* Обработчик ввода на экранной клавиатуре */ -uint8_t Keyboard_handler(char buffer[]) +uint8_t Keyboard_handler(char *prompt, char buffer[]) { uint8_t i; uint8_t len; @@ -409,6 +409,10 @@ /* Проверяем, есть ли новое нажатие */ key = Keyboard_check(); + BSP_LCD_ClearStringLine(0); + BSP_LCD_DisplayStringAtLine(0, (uint8_t *) prompt); + + /* Если нажата стандартная клавиша или клавиша "Space" */ if ((key >= KEY_SPACE_VALUE) && (key != KEY_DELETE_VALUE)) { @@ -422,8 +426,13 @@ keyboard.buffer[i + 1] = '\0'; /* Отображаем буфер клавиатуры на верхней строчке дисплея */ + BSP_LCD_ClearStringLine(0); - BSP_LCD_DisplayStringAtLine(0, (uint8_t *) keyboard.buffer); + BSP_LCD_DisplayStringAtLine(0, (uint8_t *) prompt); + + BSP_LCD_ClearStringLine(1); + BSP_LCD_DisplayStringAtLine(1, (uint8_t *) keyboard.buffer); + } } /* Если нажата специальная клавиша */ @@ -445,7 +454,10 @@ /* Затираем верхнюю строчку на дисплее */ BSP_LCD_ClearStringLine(0); - BSP_LCD_DisplayStringAtLine(0, (uint8_t *) keyboard.buffer); + BSP_LCD_DisplayStringAtLine(0, (uint8_t *) prompt); + + BSP_LCD_ClearStringLine(1); + BSP_LCD_DisplayStringAtLine(1, (uint8_t *) keyboard.buffer); } /* Если нажата клавиша "Shift", меняем раскладку клавиатуры */ @@ -469,8 +481,9 @@ if (len != 0) { keyboard.buffer[len - 1] = '\0'; - BSP_LCD_ClearStringLine(0); - BSP_LCD_DisplayStringAtLine(0, (uint8_t *) keyboard.buffer); + + BSP_LCD_ClearStringLine(1); + BSP_LCD_DisplayStringAtLine(1, (uint8_t *) keyboard.buffer); } } }