mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-07-05 22:12:40 +00:00
dm: led: Adjust the LED uclass
At present this is very simple, supporting only on and off. We want to also support toggling and blinking. As a first step, change the name of the main method and use an enum to indicate the state. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ziping Chen <techping.chan@gmail.com>
This commit is contained in:
parent
56e19871dc
commit
ddae9fcddc
4 changed files with 22 additions and 14 deletions
|
@ -41,9 +41,10 @@ static int dm_test_led_gpio(struct unit_test_state *uts)
|
|||
ut_assertok(uclass_get_device(UCLASS_LED, 1, &dev));
|
||||
ut_assertok(uclass_get_device(UCLASS_GPIO, 1, &gpio));
|
||||
ut_asserteq(0, sandbox_gpio_get_value(gpio, offset));
|
||||
led_set_on(dev, 1);
|
||||
ut_assertok(led_set_state(dev, LEDST_ON));
|
||||
ut_asserteq(1, sandbox_gpio_get_value(gpio, offset));
|
||||
led_set_on(dev, 0);
|
||||
|
||||
ut_assertok(led_set_state(dev, LEDST_OFF));
|
||||
ut_asserteq(0, sandbox_gpio_get_value(gpio, offset));
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue