|
Zephyr API Documentation 4.5.0-rc1
A Scalable Open Source RTOS
|
Fake LED controller driver. More...
Files | |
| file | led_fake.h |
| Fake LED controller driver API functions. | |
Functions | |
| int | fake_led_on (const struct device *, uint32_t) |
| Fake implementation of the led_driver_api::on driver operation. | |
| int | fake_led_off (const struct device *, uint32_t) |
| Fake implementation of the led_driver_api::off driver operation. | |
| int | fake_led_set_brightness (const struct device *, uint32_t, uint8_t) |
| Fake implementation of the led_driver_api::set_brightness driver operation. | |
| int | fake_led_blink (const struct device *, uint32_t, uint32_t, uint32_t) |
| Fake implementation of the led_driver_api::blink driver operation. | |
| int | fake_led_get_info (const struct device *, uint32_t, const struct led_info **) |
| Fake implementation of the led_driver_api::get_info driver operation. | |
| int | fake_led_set_color (const struct device *, uint32_t, uint8_t, const uint8_t *) |
| Fake implementation of the led_driver_api::set_color driver operation. | |
| int | fake_led_write_channels (const struct device *, uint32_t, uint32_t, const uint8_t *) |
| Fake implementation of the led_driver_api::write_channels driver operation. | |
Fake LED controller driver.
This is a Fake Function Framework (FFF) implementation of the LED API, provided for use in tests. It is enabled by CONFIG_LED_FAKE and instantiated from zephyr,fake-leds devicetree nodes.
Each fake below is paired with an FFF control structure named after it with an additional _fake suffix, which tests use to set return values, install custom fakes, or inspect call counts and captured arguments. The control structures are not listed here; see Mocking via FFF.
Use return_val for fakes that only report status; a fake with output parameters must be driven with a custom_fake, as return_val leaves those parameters untouched.
When CONFIG_ZTEST is enabled, a ztest rule resets every fake before each test case.
fake_led_get_info() and fake_led_set_color() are given a default custom_fake resolving the LED index and colour count against the devicetree node, re-installed on every reset. Install your own custom_fake in the test case to change what they report.
#include <zephyr/drivers/led/led_fake.h>
Fake implementation of the led_driver_api::blink driver operation.
#include <zephyr/drivers/led/led_fake.h>
Fake implementation of the led_driver_api::get_info driver operation.
#include <zephyr/drivers/led/led_fake.h>
Fake implementation of the led_driver_api::off driver operation.
#include <zephyr/drivers/led/led_fake.h>
Fake implementation of the led_driver_api::on driver operation.
#include <zephyr/drivers/led/led_fake.h>
Fake implementation of the led_driver_api::set_brightness driver operation.
#include <zephyr/drivers/led/led_fake.h>
Fake implementation of the led_driver_api::set_color driver operation.
#include <zephyr/drivers/led/led_fake.h>
Fake implementation of the led_driver_api::write_channels driver operation.