123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- #ifndef ZEPHYR_INCLUDE_DRIVERS_LED_STRIP_H_
- #define ZEPHYR_INCLUDE_DRIVERS_LED_STRIP_H_
- #include <zephyr/types.h>
- #include <device.h>
- #ifdef __cplusplus
- extern "C" {
- #endif
- struct led_rgb {
- #ifdef CONFIG_LED_STRIP_RGB_SCRATCH
-
- uint8_t scratch;
- #endif
-
- uint8_t r;
-
- uint8_t g;
-
- uint8_t b;
- };
- typedef int (*led_api_update_rgb)(const struct device *dev,
- struct led_rgb *pixels,
- size_t num_pixels);
- typedef int (*led_api_update_channels)(const struct device *dev,
- uint8_t *channels,
- size_t num_channels);
- struct led_strip_driver_api {
- led_api_update_rgb update_rgb;
- led_api_update_channels update_channels;
- };
- static inline int led_strip_update_rgb(const struct device *dev,
- struct led_rgb *pixels,
- size_t num_pixels) {
- const struct led_strip_driver_api *api =
- (const struct led_strip_driver_api *)dev->api;
- return api->update_rgb(dev, pixels, num_pixels);
- }
- static inline int led_strip_update_channels(const struct device *dev,
- uint8_t *channels,
- size_t num_channels) {
- const struct led_strip_driver_api *api =
- (const struct led_strip_driver_api *)dev->api;
- return api->update_channels(dev, channels, num_channels);
- }
- #ifdef __cplusplus
- }
- #endif
- #endif
|