[U-Boot] [PATCH23/23] Cmd: LED: make DM-leds toggle
Benjamin Tietz
uboot at dresden.micronet24.de
Sat Jun 18 14:57:22 CEST 2016
From: Benjamin Tietz <benjamin at micronet24.de>
---
cmd/led.c | 10 ++++++++++
1 file changed, 10 insertions(+)
-------------- next part --------------
From: Benjamin Tietz <benjamin at micronet24.de>
---
cmd/led.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/cmd/led.c b/cmd/led.c
index 99358c6..3728d30 100644
--- a/cmd/led.c
+++ b/cmd/led.c
@@ -195,11 +195,21 @@ static void _led_dm_onoff(const led_tbl_t *led, enum led_cmd cmd, char *arg)
led_set_on(dev, cmd == LED_ON);
}
+static void _led_dm_toggle(const led_tbl_t *led, enum led_cmd cmd, char *arg)
+{
+ struct udevice *dev = NULL;
+ if(led_get_by_label(led->string, &dev))
+ return;
+ if(dev)
+ led_toggle(dev);
+}
+
// this isn't const, as the string will be replaced by the current led's label, always.
static led_tbl_t _led_dm = {
.op = {
[LED_ON] = _led_dm_onoff,
[LED_OFF] = _led_dm_onoff,
+ [LED_TOGGLE] = _led_dm_toggle,
[LED_LIST] = _led_list_name,
},
};
More information about the U-Boot
mailing list