]> wirehaze git hosting - stm32f411ceu6.git/blobdiff - kentry.c

wirehaze git hosting

organize
[stm32f411ceu6.git] / kentry.c
index 33b829549499e656dba32db722bab7e972c3f08b..e9eab94499ba19eb28e5deda41f4826b78d1cf5d 100644 (file)
--- 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 ();
         }
     }
 }