import { _ as _export_sfc, c as createElementBlock, o as openBlock, a8 as createStaticVNode } from "./chunks/framework.DyMmIvSC.js"; const __pageData = JSON.parse('{"title":"APA102 Driver","description":"","frontmatter":{},"headers":[],"relativePath":"drivers/apa102.md","filePath":"drivers/apa102.md"}'); const _sfc_main = { name: "drivers/apa102.md" }; const _hoisted_1 = /* @__PURE__ */ createStaticVNode('
This driver provides support for APA102 addressable RGB LEDs. They are similar to the WS2812 LEDs, but have increased data and refresh rates.
In most cases, the APA102 driver code is automatically included if you are using either the RGBLight or RGB Matrix feature with the apa102
driver set, and you would use those APIs instead.
However, if you need to use the driver standalone, add the following to your rules.mk
:
APA102_DRIVER_REQUIRED = yes
You can then call the APA102 API by including apa102.h
in your code.
Add the following to your config.h
:
Define | Default | Description |
---|---|---|
APA102_DI_PIN | Not defined | The GPIO pin connected to the DI pin of the first LED in the chain |
APA102_CI_PIN | Not defined | The GPIO pin connected to the CI pin of the first LED in the chain |
APA102_DEFAULT_BRIGHTNESS | 31 | The default global brightness level of the LEDs, from 0 to 31 |
void apa102_init(void)
Initialize the LED driver. This function should be called first.
void apa102_set_color(uint16_t index, uint8_t red, uint8_t green, uint8_t blue)
Set the color of a single LED. This function does not immediately update the LEDs; call apa102_flush()
after you are finished.
uint16_t index
uint8_t red
uint8_t green
uint8_t blue
void apa102_set_color_all(uint8_t red, uint8_t green, uint8_t blue)
Set the color of all LEDs.
uint8_t red
uint8_t green
uint8_t blue
void apa102_flush(void)
Flush the PWM values to the LED chain.
void apa102_set_brightness(uint8_t brightness)
Set the global brightness.
uint8_t brightness