application (minor): improve main loop interactiveness
This commit is contained in:
parent
64736947e9
commit
99a039c3c8
|
@ -363,13 +363,13 @@ void main(void)
|
|||
button_flag = false; // reset button flag
|
||||
while (true) { // infinite loop
|
||||
iwdg_reset(); // kick the dog
|
||||
while (user_input_available) { // user input is available
|
||||
if (user_input_available) { // user input is available
|
||||
action = true; // action has been performed
|
||||
led_toggle(); // toggle LED
|
||||
char c = user_input_get(); // store receive character
|
||||
terminal_send(c); // send received character to terminal
|
||||
}
|
||||
while (button_flag) { // user pressed button
|
||||
if (button_flag) { // user pressed button
|
||||
action = true; // action has been performed
|
||||
printf("button pressed\n");
|
||||
led_toggle(); // toggle LED
|
||||
|
@ -378,7 +378,7 @@ void main(void)
|
|||
}
|
||||
button_flag = false; // reset flag
|
||||
}
|
||||
while (rtc_internal_tick_flag) { // the internal RTC ticked
|
||||
if (rtc_internal_tick_flag) { // the internal RTC ticked
|
||||
rtc_internal_tick_flag = false; // reset flag
|
||||
action = true; // action has been performed
|
||||
led_toggle(); // toggle LED (good to indicate if main function is stuck)
|
||||
|
|
Loading…
Reference in New Issue