diff options
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 (); + } + +} |