summaryrefslogtreecommitdiffstats
path: root/firmware/drivers/led.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/led.c')
-rw-r--r--firmware/drivers/led.c54
1 files changed, 30 insertions, 24 deletions
diff --git a/firmware/drivers/led.c b/firmware/drivers/led.c
index ca4aadac71..1e38fa63d3 100644
--- a/firmware/drivers/led.c
+++ b/firmware/drivers/led.c
@@ -23,44 +23,50 @@
#include "system.h"
#include "kernel.h"
+static bool disk_led_status;
+static long last_on; /* timestamp of switching off */
+
+
+
+void disk_led_on(void)
+{
+ disk_led_status=true;
#if CONFIG_LED == LED_REAL
+#ifdef GMINI_ARCH
+ P2 |= 1;
+#else
+ or_b(0x40, &PBDRL);
+#endif
+#endif
+}
-void led(bool on)
+void disk_led_off(void)
{
- if ( on )
+ if(disk_led_status)
+ {
+ last_on = current_tick;/* remember for off delay */
+ disk_led_status=false;
+#if CONFIG_LED == LED_REAL
#ifdef GMINI_ARCH
- P2 |= 1;
- else
P2 &= ~1;
#else
- {
- or_b(0x40, &PBDRL);
- }
- else
- {
and_b(~0x40, &PBDRL);
- }
#endif
+#endif
+ }
}
-#elif CONFIG_LED == LED_VIRTUAL
-
-static bool current;
-static long last_on; /* timestamp of switching off */
-
void led(bool on)
{
- if (current && !on) /* switching off */
- {
- last_on = current_tick; /* remember for off delay */
- }
- current = on;
+ if ( on )
+ disk_led_on();
+ else
+ disk_led_off();
}
-bool led_read(int delayticks) /* read by status bar update */
+bool led_read(int delayticks)
{
/* reading "off" is delayed by user-supplied monoflop value */
- return (current || TIME_BEFORE(current_tick, last_on+delayticks));
+ return (disk_led_status ||
+ TIME_BEFORE(current_tick, last_on+delayticks));
}
-
-#endif /* CONFIG_LED */