1
0
Fork 0

APA102: API rework (#23355)

This commit is contained in:
Ryan 2024-06-13 22:19:45 +10:00 committed by GitHub
parent c4a74be7f0
commit 55538b2e1e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 70 additions and 29 deletions

View file

@ -26,20 +26,51 @@ Add the following to your `config.h`:
## API {#api}
### `void apa102_setleds(rgb_led_t *start_led, uint16_t num_leds)`
### `void apa102_init(void)` {#api-apa102-init}
Send RGB data to the APA102 LED chain.
#### Arguments {#api-apa102-setleds-arguments}
- `rgb_led_t *start_led`
A pointer to the LED array.
- `uint16_t num_leds`
The length of the LED array.
Initialize the LED driver. This function should be called first.
---
### `void apa102_set_brightness(uint8_t brightness)`
### `void apa102_set_color(uint16_t index, uint8_t red, uint8_t green, uint8_t blue)` {#api-apa102-set-color}
Set the color of a single LED. This function does not immediately update the LEDs; call `apa102_flush()` after you are finished.
#### Arguments {#api-apa102-set-color-arguments}
- `uint16_t index`
The LED index in the APA102 chain.
- `uint8_t red`
The red value to set.
- `uint8_t green`
The green value to set.
- `uint8_t blue`
The blue value to set.
---
### `void apa102_set_color_all(uint8_t red, uint8_t green, uint8_t blue)` {#api-apa102-set-color-all}
Set the color of all LEDs.
#### Arguments {#api-apa102-set-color-all-arguments}
- `uint8_t red`
The red value to set.
- `uint8_t green`
The green value to set.
- `uint8_t blue`
The blue value to set.
---
### `void apa102_flush(void)` {#api-apa102-flush}
Flush the PWM values to the LED chain.
---
### `void apa102_set_brightness(uint8_t brightness)` {#api-apa102-set-brightness}
Set the global brightness.