summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schodet2010-07-18 23:50:42 +0200
committerNicolas Schodet2010-07-18 23:50:42 +0200
commit88f4f84d93390e224b7c70a7af349fd905ce364c (patch)
treececeb42d481e63c302dfcdf8eff6fdde44e132f7
parent51f02daf45e5cc8215d9d81fdf1316783dc62721 (diff)
src/common/led: add pull-up
-rw-r--r--src/common/led.c9
-rw-r--r--src/common/led.h4
2 files changed, 12 insertions, 1 deletions
diff --git a/src/common/led.c b/src/common/led.c
index dd01653..194e20e 100644
--- a/src/common/led.c
+++ b/src/common/led.c
@@ -56,6 +56,13 @@ struct led_t led_tab[] =
};
void
+led_init (void)
+{
+ /* Activate pull-up. */
+ PORTB |= LED_MASK;
+}
+
+void
led_display (uint16_t leds, uint16_t duration)
{
uint8_t portb, ddrb;
@@ -76,7 +83,7 @@ led_display (uint16_t leds, uint16_t duration)
utils_delay_ms (LED_UP_MS);
/* Turn off, leds are too bright. */
DDRB = ddrb;
- PORTB = portb;
+ PORTB = portb | LED_MASK;
utils_delay_ms (LED_DOWN_MS);
}
}
diff --git a/src/common/led.h b/src/common/led.h
index e9bb1b3..e6ce0d0 100644
--- a/src/common/led.h
+++ b/src/common/led.h
@@ -24,6 +24,10 @@
* Email: <nico at ni.fr.eu.org>
* }}} */
+/** Initialise leds. */
+void
+led_init (void);
+
/** Display a binary number on leds during a duration (1 = 5 ms). */
void
led_display (uint16_t leds, uint16_t duration);