Splitted out the usart recv and send functions to have blocking and non blocking versions of those.
This commit is contained in:
@@ -78,11 +78,11 @@ int main(void)
|
||||
/* Blink the LED (PC12) on the board with every transmitted byte. */
|
||||
while (1) {
|
||||
gpio_toggle(GPIOA, GPIO6); /* LED on/off */
|
||||
usart_send(USART1, c + '0'); /* Send one byte on USART3. */
|
||||
usart_send_blocking(USART1, c + '0'); /* Send one byte on USART3. */
|
||||
c = (c == 9) ? 0 : c + 1; /* Increment c. */
|
||||
if ((j++ % 80) == 0) { /* Newline after line full. */
|
||||
usart_send(USART1, '\r');
|
||||
usart_send(USART1, '\n');
|
||||
usart_send_blocking(USART1, '\r');
|
||||
usart_send_blocking(USART1, '\n');
|
||||
}
|
||||
for (i = 0; i < 80000; i++); /* Wait (needs -O0 CFLAGS). */
|
||||
}
|
||||
|
||||
@@ -69,11 +69,11 @@ int main(void)
|
||||
/* Blink the LED (PC12) on the board with every transmitted byte. */
|
||||
while (1) {
|
||||
gpio_toggle(GPIOC, GPIO12); /* LED on/off */
|
||||
usart_send(USART3, c + '0'); /* Send one byte on USART3. */
|
||||
usart_send_blocking(USART3, c + '0'); /* Send one byte on USART3. */
|
||||
c = (c == 9) ? 0 : c + 1; /* Increment c. */
|
||||
if ((j++ % 80) == 0) { /* Newline after line full. */
|
||||
usart_send(USART3, '\r');
|
||||
usart_send(USART3, '\n');
|
||||
usart_send_blocking(USART3, '\r');
|
||||
usart_send_blocking(USART3, '\n');
|
||||
}
|
||||
for (i = 0; i < 80000; i++); /* Wait (needs -O0 CFLAGS). */
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user