From 79b1ba7104dba52dbfacf11a07305702889f440b Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Mon, 11 Apr 2016 14:44:44 -0400 Subject: Reorganize Makefile and directory structure, because it's messy, and it's about to get messier. --- projects/board-test/uart-test.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 projects/board-test/uart-test.c (limited to 'projects/board-test/uart-test.c') diff --git a/projects/board-test/uart-test.c b/projects/board-test/uart-test.c new file mode 100644 index 0000000..8fe7795 --- /dev/null +++ b/projects/board-test/uart-test.c @@ -0,0 +1,34 @@ +/* + * Test code that just sends the letters 'a' to 'z' over and + * over again using USART2. + * + * Toggles the BLUE LED slowly and the RED LED for every + * character sent. + */ +#include "stm32f4xx_hal.h" +#include "stm-init.h" +#include "stm-led.h" +#include "stm-uart.h" + +#define DELAY() HAL_Delay(100) + +int +main() +{ + uint8_t c = 'a'; + + stm_init(); + + while (1) + { + HAL_GPIO_TogglePin(LED_PORT, LED_RED); + + uart_send_char(c); + DELAY(); + + if (c++ == 'z') { + c = 'a'; + HAL_GPIO_TogglePin(LED_PORT, LED_BLUE); + } + } +} -- cgit v1.2.3