summaryrefslogtreecommitdiffstats
path: root/app/led.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/led.c')
-rw-r--r--app/led.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/app/led.c b/app/led.c
index dfa343e..bda76ea 100644
--- a/app/led.c
+++ b/app/led.c
@@ -9,48 +9,39 @@ static int led_cycle = 0;
void
led_init (void)
{
- gpio_set_mode (GPIOA, GPIO_MODE_OUTPUT_2_MHZ,
- GPIO_CNF_OUTPUT_PUSHPULL, GPIO9);
+ gpio_set_mode (GPIOC, GPIO_MODE_OUTPUT_2_MHZ,
+ GPIO_CNF_OUTPUT_PUSHPULL, GPIO13);
- gpio_set (GPIOA, GPIO9);
+ gpio_set (GPIOA, GPIO13);
}
+#if 0
void
led_blink (void)
{
- gpio_set (GPIOA, GPIO9);
+ gpio_set (GPIOC, GPIO13);
led_on = 50;
}
+#endif
void
led_tick (void)
{
- if (led_on)
- {
- led_on--;
- if (!led_on)
- gpio_clear (GPIOA, GPIO9);
- }
+ led_cycle++;
- led_cycle++;
+ if (led_cycle<500)
+ return;
- if (led_cycle == LED_PERIOD)
- {
- led_cycle = 0;
+ led_cycle=0;
+ led_on=!led_on;
+ if (led_on)
+ gpio_clear (GPIOC, GPIO13);
+ else
+ gpio_set (GPIOC, GPIO13);
- if (have_key && locked)
- led_on = 50;
- if (have_key && !locked)
- led_on = 500;
- if (!have_key)
- led_on = 1000;
-
- gpio_set (GPIOA, GPIO9);
-
- }
}