diff options
author | fishsoupisgood <github@madingley.org> | 2020-06-18 13:26:56 +0100 |
---|---|---|
committer | fishsoupisgood <github@madingley.org> | 2020-06-18 13:26:56 +0100 |
commit | e41764fceeabb1cdb6a7a299e00f2166a6f6ac32 (patch) | |
tree | c58c73d742bf990ec692d61ca8d911dd43fab8c6 /stm32/app/led.c | |
parent | f7b7cf9e80200cade938d47527e39034c75b9b6d (diff) | |
download | robs_speedo-e41764fceeabb1cdb6a7a299e00f2166a6f6ac32.tar.gz robs_speedo-e41764fceeabb1cdb6a7a299e00f2166a6f6ac32.tar.bz2 robs_speedo-e41764fceeabb1cdb6a7a299e00f2166a6f6ac32.zip |
moved stm32 into directory added noddy pcb
Diffstat (limited to 'stm32/app/led.c')
-rw-r--r-- | stm32/app/led.c | 42 |
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(); + } + +} |