From 26f12903dab2fafeaaefb02349763618ce96d070 Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Mon, 26 Oct 2015 15:18:58 -0400 Subject: Based on user/ft/stm32-dev-bridge, without the project-specific build directories (and duplicated code). --- led-test.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 led-test.c (limited to 'led-test.c') diff --git a/led-test.c b/led-test.c new file mode 100644 index 0000000..5e4401f --- /dev/null +++ b/led-test.c @@ -0,0 +1,33 @@ +/* + * Blink the four LEDs on the rev01 board in a pattern. + */ +#include "stm32f4xx_hal.h" +#include "stm-init.h" +#include "stm-led.h" + +#define DELAY() HAL_Delay(125) + +void toggle_led(uint32_t times, uint32_t led_pin) +{ + uint32_t i; + + for (i = 0; i < times; i++) { + HAL_GPIO_TogglePin(LED_PORT, led_pin); + DELAY(); + } +} + +int +main() +{ + stm_init(); + + while (1) + { + toggle_led(2, LED_BLUE); + toggle_led(2, LED_GREEN); + toggle_led(2, LED_YELLOW); + toggle_led(2, LED_RED); + } + +} -- cgit v1.2.3