Skip to content

Commit d868339

Browse files
author
Maksymilian Wojczuk
committed
Wakaama
Removed active waiting for user input
1 parent 209525e commit d868339

File tree

3 files changed

+32
-34
lines changed

3 files changed

+32
-34
lines changed

Src/communication/dbgu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ char debug_waitkey(void)
8585

8686
do
8787
{
88-
res = HAL_UART_Receive(pUart,&rxed,1,HAL_MAX_DELAY);
88+
osDelay(1);
89+
res = HAL_UART_Receive(pUart,&rxed,1,3);
8990
}
9091
while(res != HAL_OK);
9192
return rxed;

Src/communication/term_io.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ void get_line (char *buff, int len)
198198
int idx = 0;
199199

200200
for (;;) {
201+
osDelay(5);
201202
c = xgetc();
202203
if (c == '\r') break;
203204
if ((c == '\b') && idx) {

Src/main.c

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -651,40 +651,36 @@ void StartDefaultTask(void const * argument)
651651
printf("Error creating socket: ");
652652
}
653653

654-
while(1) {
655-
osDelay(500);
656-
}
657-
658654
// TODO: We cannot wait actively for user input since it kills the connection
659-
// int x = 0;
660-
// osDelay(500);
661-
// HAL_GPIO_WritePin(USB_GPIO_OUT_GPIO_Port, USB_GPIO_OUT_Pin, GPIO_PIN_SET);
662-
// BlinkBlue();
663-
// char usrInput[2];
664-
// /* Infinite loop */
665-
// debug_init(&huart3);
666-
// for(;;)
667-
// {
668-
// osDelay(5);
669-
// printf("in loop %d\n\r", x);
670-
// x++;
671-
// printf("$ ");
672-
// fflush(stdout);
673-
// get_line(usrInput, 2);
674-
// printf("%s\n", usrInput);
675-
// switch(usrInput[0]) {
676-
// case 'l':
677-
// if (get_usb_ready()) {
678-
// usb_ls();
679-
// }
680-
// break;
681-
// case 'w':
682-
// if (get_usb_ready()) {
683-
// usb_write("asd", 3);
684-
// }
685-
// break;
686-
// }
687-
// }
655+
int x = 0;
656+
osDelay(500);
657+
HAL_GPIO_WritePin(USB_GPIO_OUT_GPIO_Port, USB_GPIO_OUT_Pin, GPIO_PIN_SET);
658+
BlinkBlue();
659+
char usrInput[2];
660+
/* Infinite loop */
661+
debug_init(&huart3);
662+
for(;;)
663+
{
664+
osDelay(5);
665+
printf("in loop %d\n\r", x);
666+
x++;
667+
printf("$ ");
668+
fflush(stdout);
669+
get_line(usrInput, 2);
670+
printf("%s\n", usrInput);
671+
switch(usrInput[0]) {
672+
case 'l':
673+
if (get_usb_ready()) {
674+
usb_ls();
675+
}
676+
break;
677+
case 'w':
678+
if (get_usb_ready()) {
679+
usb_write("asd", 3);
680+
}
681+
break;
682+
}
683+
}
688684
/* USER CODE END 5 */
689685
}
690686

0 commit comments

Comments
 (0)