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: main.cpp
- Revision:
- 4:0e5755618652
- Parent:
- 3:12b494808ffa
- Child:
- 5:50c5e677f71a
--- a/main.cpp Wed Feb 15 20:29:17 2017 +0000 +++ b/main.cpp Fri Feb 17 18:29:25 2017 +0000 @@ -111,12 +111,13 @@ } -void get_kbd_str(char *bufr) + +void get_kbd_str(char *promp, char *bufr) { start_KB_LCD(); Keyboard_init(0, 80); while(1) { - key = Keyboard_handler(bufr); + key = Keyboard_handler(promp, bufr); if (key == KEY_ENTER_VALUE) break; // to go to another screen ? HAL_Delay(10); } @@ -127,6 +128,8 @@ + + /* Основная программа */ int main(void) { @@ -165,24 +168,20 @@ pc.baud(9600); - + + for (u_tries = 0; u_tries < 2; u_tries++) { start_KB_LCD(); BSP_LCD_SetFont(&Font24); - strcpy(msg_b, "ENTER NAME"); - BSP_LCD_DisplayStringAtLine(1, (uint8_t *) msg_b); - HAL_Delay(2000); - get_kbd_str(kb_buffer); + get_kbd_str("ENTER NAME:", kb_buffer); + strcpy(u_name, kb_buffer); kb_buffer[0] = '\0'; start_KB_LCD(); BSP_LCD_SetFont(&Font24); - strcpy(msg_b, "ENTER PASSWORD"); - BSP_LCD_DisplayStringAtLine(1, (uint8_t *) msg_b); - HAL_Delay(2000); - get_kbd_str(kb_buffer); + get_kbd_str("ENTER PASSWORD:", kb_buffer); strcpy(u_passwd, kb_buffer); kb_buffer[0] = '\0'; @@ -194,11 +193,16 @@ strcpy(out_str, "USER PASWD: "); strcat(out_str, u_passwd); BSP_LCD_DisplayStringAtLine(4, (uint8_t *) out_str); - HAL_Delay(150); + HAL_Delay(3000); } + + + + + start_KB_LCD(); BSP_LCD_SetFont(&Font16);