diff options
author | fishsoupisgood <github@madingley.org> | 2020-06-13 21:05:45 +0100 |
---|---|---|
committer | fishsoupisgood <github@madingley.org> | 2020-06-13 21:05:45 +0100 |
commit | d85f3aeeeefd6926fe71ec8e066adb74f62dc1cc (patch) | |
tree | fc4e43a80dc50717d41a869dddce20c94a0f25c4 /app/led.c | |
download | robs_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.c | 37 |
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 (); + } + +} |