···26262727## API {#api}
28282929-### `void apa102_setleds(rgb_led_t *start_led, uint16_t num_leds)`
2929+### `void apa102_init(void)` {#api-apa102-init}
3030+3131+Initialize the LED driver. This function should be called first.
3232+3333+---
3434+3535+### `void apa102_set_color(uint16_t index, uint8_t red, uint8_t green, uint8_t blue)` {#api-apa102-set-color}
3636+3737+Set the color of a single LED. This function does not immediately update the LEDs; call `apa102_flush()` after you are finished.
3838+3939+#### Arguments {#api-apa102-set-color-arguments}
4040+4141+ - `uint16_t index`
4242+ The LED index in the APA102 chain.
4343+ - `uint8_t red`
4444+ The red value to set.
4545+ - `uint8_t green`
4646+ The green value to set.
4747+ - `uint8_t blue`
4848+ The blue value to set.
4949+5050+---
5151+5252+### `void apa102_set_color_all(uint8_t red, uint8_t green, uint8_t blue)` {#api-apa102-set-color-all}
5353+5454+Set the color of all LEDs.
5555+5656+#### Arguments {#api-apa102-set-color-all-arguments}
5757+5858+ - `uint8_t red`
5959+ The red value to set.
6060+ - `uint8_t green`
6161+ The green value to set.
6262+ - `uint8_t blue`
6363+ The blue value to set.
30643131-Send RGB data to the APA102 LED chain.
6565+---
32663333-#### Arguments {#api-apa102-setleds-arguments}
6767+### `void apa102_flush(void)` {#api-apa102-flush}
34683535- - `rgb_led_t *start_led`
3636- A pointer to the LED array.
3737- - `uint16_t num_leds`
3838- The length of the LED array.
6969+Flush the PWM values to the LED chain.
39704071---
41724242-### `void apa102_set_brightness(uint8_t brightness)`
7373+### `void apa102_set_brightness(uint8_t brightness)` {#api-apa102-set-brightness}
43744475Set the global brightness.
4576
···3232#define APA102_MAX_BRIGHTNESS 31
33333434void apa102_init(void);
3535-3636-/* User Interface
3737- *
3838- * Input:
3939- * start_led: An array of GRB data describing the LED colors
4040- * num_leds: The number of LEDs to write
4141- *
4242- * The functions will perform the following actions:
4343- * - Set the data-out pin as output
4444- * - Send out the LED data
4545- */
4646-void apa102_setleds(rgb_led_t *start_led, uint16_t num_leds);
3535+void apa102_set_color(uint16_t index, uint8_t red, uint8_t green, uint8_t blue);
3636+void apa102_set_color_all(uint8_t red, uint8_t green, uint8_t blue);
3737+void apa102_flush(void);
47384839void apa102_set_brightness(uint8_t brightness);