X-Git-Url: https://git.wirehaze.ovh/stm32f411ceu6.git/blobdiff_plain/8b035a8bab6355d1addd7440a92116e2e23e4419..4bfee77ecbb19ef2143a1cd486cfa92bd3aceef4:/kentry.c diff --git a/kentry.c b/kentry.c index 33b8295..e9eab94 100644 --- a/kentry.c +++ b/kentry.c @@ -1,4 +1,7 @@ -#include "stm32f411.h" +#include "uart.h" +#include "led.h" + +__attribute__ ((noreturn)) void kentry (void); static const char *text[] = { "hello, friend.\r\n", @@ -15,7 +18,7 @@ static const char *text[] = { void kentry (void) { - unsigned int line, off; + unsigned int line; /* Test UART and LED ---------------------------------------------------- */ @@ -23,24 +26,8 @@ kentry (void) { for (line = 0; line < sizeof text / sizeof *text; ++line) { - /* Print current line */ - off = 0; - while (text[line][off]) - { - /* TXE: Transmit data register empty */ - while (!(*USART1_SR & (1u << 7))); /* 0: Data is not transferred - to the shift register */ - - /* DR[8:0]: Data value */ - *USART1_DR = text[line][off++]; - } - - /* TC: Transmission complete */ - while (!(*USART1_SR & (1u << 6))); /* 0: Transmission is not - complete */ - - /* Blink LED */ - *GPIOC_ODR ^= (1u << 13); + kputs_busytc (text[line]); + led_toggle (); } } }