summaryrefslogtreecommitdiffstats
path: root/stm32/app/led.c
diff options
context:
space:
mode:
Diffstat (limited to 'stm32/app/led.c')
-rw-r--r--stm32/app/led.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/stm32/app/led.c b/stm32/app/led.c
new file mode 100644
index 0000000..57baa17
--- /dev/null
+++ b/stm32/app/led.c
@@ -0,0 +1,42 @@
+#include "project.h"
+
+
+#define LED GPIO13
+#define LED_PORT GPIOC
+
+static int led = 0;
+
+void
+led_init (void)
+{
+ MAP_OUTPUT_OD (LED);
+ SET (LED);
+
+}
+
+
+void
+led_clear (void)
+{
+ SET (LED);
+ led = 0;
+}
+
+void
+led_set (void)
+{
+ CLEAR (LED);
+ led = MS_TO_TICKS (200);
+}
+
+void
+led_tick (void)
+{
+ if (led) {
+ led--;
+
+ if (!led)
+ led_clear();
+ }
+
+}