TUKS MCU Introductory course / TUKS-COURSE-TIMER
Revision:
0:a9bbfbd216e8
Child:
2:5acdd8565d02
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.c	Fri Feb 24 21:06:51 2017 +0000
@@ -0,0 +1,29 @@
+#define USE_STM32L476G_DISCO_REVC
+#include "stm32l476g_discovery.h"
+#include "stm32l4xx_hal.h"
+
+
+// main() runs in its own thread in the OS
+// (note the calls to wait below for delays)
+int main() {
+
+    LED4_GPIO_CLK_ENABLE();
+    LED5_GPIO_CLK_ENABLE();
+    
+    GPIO_InitTypeDef gpio;
+    gpio.Mode = GPIO_MODE_OUTPUT_PP;
+    gpio.Pull = GPIO_NOPULL;
+    gpio.Speed = GPIO_SPEED_FREQ_LOW;
+    gpio.Pin = LED4_PIN;
+    HAL_GPIO_Init(LED4_GPIO_PORT, &gpio);
+
+    gpio.Pin = LED5_PIN;
+    HAL_GPIO_Init(LED5_GPIO_PORT, &gpio);
+
+    while (1) {
+        HAL_GPIO_TogglePin(LED5_GPIO_PORT, LED5_PIN);
+        HAL_Delay(300);
+        HAL_GPIO_TogglePin(LED4_GPIO_PORT, LED4_PIN);
+    }
+}
+