summaryrefslogtreecommitdiffstats
path: root/app/led.c
diff options
context:
space:
mode:
authorfishsoupisgood <github@madingley.org>2020-06-13 21:05:45 +0100
committerfishsoupisgood <github@madingley.org>2020-06-13 21:05:45 +0100
commitd85f3aeeeefd6926fe71ec8e066adb74f62dc1cc (patch)
treefc4e43a80dc50717d41a869dddce20c94a0f25c4 /app/led.c
downloadrobs_speedo-d85f3aeeeefd6926fe71ec8e066adb74f62dc1cc.tar.gz
robs_speedo-d85f3aeeeefd6926fe71ec8e066adb74f62dc1cc.tar.bz2
robs_speedo-d85f3aeeeefd6926fe71ec8e066adb74f62dc1cc.zip
fish
Diffstat (limited to 'app/led.c')
-rw-r--r--app/led.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/app/led.c b/app/led.c
new file mode 100644
index 0000000..7d8303d
--- /dev/null
+++ b/app/led.c
@@ -0,0 +1,37 @@
+#include "project.h"
+
+
+static int led = 0;
+
+void
+led_init (void)
+{
+ gpio_set_mode (GPIOC, GPIO_MODE_OUTPUT_2_MHZ,
+ GPIO_CNF_OUTPUT_PUSHPULL, GPIO13);
+}
+
+
+void
+led_clear (void)
+{
+ gpio_set (GPIOC, GPIO13);
+}
+
+void
+led_set (void)
+{
+ gpio_clear (GPIOC, GPIO13);
+ led = 200;
+}
+
+void
+led_tick (void)
+{
+ if (led)
+ {
+ led--;
+ if (!led)
+ led_clear ();
+ }
+
+}