Currently the USART_Read funciton blocks while waiting for input. This means your read_line does as well. This causes an issue whereby you cannot both flash a light and accept input. To solve this problem you need a non-blocking verison of the USART_Read function. In this case, if their is nothing available to read, instead of waiting for something to become available it will simply return a 0. If there is something that can be read, that character should be returned.
Using this strategy you can alternate between checking for characters and checking the timer to see if it is time to toggle the led, or perform other work. Using the following instructions as a guide, make a new non-blocking USART_Read and test that you can still read characters while also making he LED flash. You will likely need to modify your readline so it can be used in a similar way for the project.
Reference: Nucleo Reference Manual (Pages 1339-1344)
Tasks:
Modify UART.c by making a copy of the USART_Read function to USART_Read_Nonblocking.
Hint: In the nonblocking version change the while to an if statement. If no character is available immediately return 0.
Modify UART.h to add the new nonblocking function prototype.
Create a test application named hw4 that both flashes the LED once per second and still allows you to input characters (echo the character to verify).
Note: The speed at which you can type may be greatly reduced and we will discuss that in class.
Submit your new and updated files by pushing them to the repo by the deadline.
To receive full credit, Code must compile and run as expected without any warnings!