diff --git a/doc/releases/release-notes-4.1.rst b/doc/releases/release-notes-4.1.rst index 6feba5b3fef..876df997c4f 100644 --- a/doc/releases/release-notes-4.1.rst +++ b/doc/releases/release-notes-4.1.rst @@ -142,6 +142,7 @@ Drivers and Sensors * Added a new set of devicetree based LED APIs, see :c:struct:`led_dt_spec`. * lp5569: added use of auto-increment functionality. * lp5569: implemented ``write_channels`` api. + * lp5569: demonstrate ``led_write_channels`` in the sample. * LED Strip diff --git a/samples/drivers/led/lp5569/README.rst b/samples/drivers/led/lp5569/README.rst index ecb04cf9965..f39fcd1678c 100644 --- a/samples/drivers/led/lp5569/README.rst +++ b/samples/drivers/led/lp5569/README.rst @@ -8,7 +8,10 @@ Overview ******** This sample controls 9 LEDs connected to an LP5569 driver. The sample turns -all LEDs on and switches all LEDs off again within a one second interval. +all LEDs on one by one with a 1 second delay between each. Then it fades all +LEDs until they are off again. Afterwards, it turns them all on at once, waits +a second, and turns them all back off. +This pattern then repeats indefinitely. Building and Running ******************** diff --git a/samples/drivers/led/lp5569/src/main.c b/samples/drivers/led/lp5569/src/main.c index fe18d5ee280..bf18ef33b38 100644 --- a/samples/drivers/led/lp5569/src/main.c +++ b/samples/drivers/led/lp5569/src/main.c @@ -18,6 +18,7 @@ LOG_MODULE_REGISTER(app, CONFIG_LED_LOG_LEVEL); int main(void) { const struct device *const led_dev = DEVICE_DT_GET_ANY(ti_lp5569); + uint8_t ch_buf[9] = {0}; int i, ret; if (!led_dev) { @@ -32,7 +33,8 @@ int main(void) /* * Display a continuous pattern that turns on 9 LEDs at 1 s one by - * one until it reaches the end and turns off LEDs in reverse order. + * one until it reaches the end and fades off all LEDs. + * Afterwards, all LEDs get blinked once at the same time. */ LOG_INF("Testing 9 LEDs .."); @@ -59,6 +61,26 @@ int main(void) k_sleep(DELAY_TIME_BREATHING); } + + k_sleep(DELAY_TIME_ON); + + /* Turn on all LEDs at once to demonstrate write_channels */ + memset(ch_buf, 255, ARRAY_SIZE(ch_buf)); + ret = led_write_channels(led_dev, 0, ARRAY_SIZE(ch_buf), ch_buf); + if (ret) { + return ret; + } + + k_sleep(DELAY_TIME_ON); + + /* Turn off all LEDs at once to demonstrate write_channels */ + memset(ch_buf, 0, ARRAY_SIZE(ch_buf)); + ret = led_write_channels(led_dev, 0, ARRAY_SIZE(ch_buf), ch_buf); + if (ret) { + return ret; + } + + k_sleep(DELAY_TIME_ON); } return 0; }