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

wirehaze git hosting

33b829549499e656dba32db722bab7e972c3f08b
[stm32f411ceu6.git] / kentry.c
1 #include "stm32f411.h"
2
3 static const char *text[] = {
4 "hello, friend.\r\n",
5 "hello, friend?\r\n",
6 "that's lame.\r\n",
7 "maybe i should give you a name.\r\n",
8 "but that's a slippery slope.\r\n",
9 "you're only in my head.\r\n",
10 "we have to remember that.\r\n",
11 "shit.\r\n",
12 "it's actually happening, i'm talking to an imaginary person.\r\n\n"
13 };
14
15 void
16 kentry (void)
17 {
18 unsigned int line, off;
19
20 /* Test UART and LED ---------------------------------------------------- */
21
22 while (1)
23 {
24 for (line = 0; line < sizeof text / sizeof *text; ++line)
25 {
26 /* Print current line */
27 off = 0;
28 while (text[line][off])
29 {
30 /* TXE: Transmit data register empty */
31 while (!(*USART1_SR & (1u << 7))); /* 0: Data is not transferred
32 to the shift register */
33
34 /* DR[8:0]: Data value */
35 *USART1_DR = text[line][off++];
36 }
37
38 /* TC: Transmission complete */
39 while (!(*USART1_SR & (1u << 6))); /* 0: Transmission is not
40 complete */
41
42 /* Blink LED */
43 *GPIOC_ODR ^= (1u << 13);
44 }
45 }
46 }