summaryrefslogtreecommitdiffstats
path: root/app/led.c
diff options
context:
space:
mode:
authorroot <root@lamia.panaceas.james.local>2015-07-16 08:47:30 +0100
committerroot <root@lamia.panaceas.james.local>2015-07-16 08:47:30 +0100
commit809b705559a51cac8cd301dbbe7e133e8607fbf6 (patch)
tree9f90b6f2b060171a94077b2972945fb5a9f39a66 /app/led.c
parent191be59e5fed6aba0158f9495df8b99894c13c17 (diff)
downloadstm32_ade-809b705559a51cac8cd301dbbe7e133e8607fbf6.tar.gz
stm32_ade-809b705559a51cac8cd301dbbe7e133e8607fbf6.tar.bz2
stm32_ade-809b705559a51cac8cd301dbbe7e133e8607fbf6.zip
change led code, and print something out
Diffstat (limited to 'app/led.c')
-rw-r--r--app/led.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/app/led.c b/app/led.c
index 64c4660..6e8fa65 100644
--- a/app/led.c
+++ b/app/led.c
@@ -7,42 +7,42 @@ void
led_init (void)
{
gpio_set_mode (GPIOB, GPIO_MODE_OUTPUT_2_MHZ,
- GPIO_CNF_OUTPUT_PUSHPULL, GPIO8);
+ GPIO_CNF_OUTPUT_PUSHPULL, LED0);
gpio_set_mode (GPIOB, GPIO_MODE_OUTPUT_2_MHZ,
- GPIO_CNF_OUTPUT_PUSHPULL, GPIO9);
+ GPIO_CNF_OUTPUT_PUSHPULL, LED1);
}
void
led_clear (void)
{
- gpio_set (GPIOB, GPIO8);
- gpio_set (GPIOB, GPIO9);
+ gpio_set (GPIOB, LED0);
+ gpio_set (GPIOB, LED1);
}
void
-led_set (uint32_t v)
+led_flash (uint32_t v)
{
gpio_clear (GPIOB, v);
led = 200;
}
+void led_set(uint32_t v)
+{
+v&= LED_MASK;
+gpio_clear(GPIOB,v);
+v^=LED_MASK;
+gpio_set(GPIOB,v);
+}
+
+
void
led_tick (void)
{
- static int c;
-
if (led)
{
led--;
if (!led)
led_clear ();
}
- else
- {
- led_set (c ? GPIO8 : GPIO9);
- c ^= 1;
- }
-
-
}