You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.8 KiB

  1. # APA102 Driver :id=apa102-driver
  2. This driver provides support for APA102 addressable RGB LEDs. They are similar to the [WS2812](ws2812_driver.md) LEDs, but have increased data and refresh rates.
  3. ## Usage :id=usage
  4. In most cases, the APA102 driver code is automatically included if you are using either the [RGBLight](feature_rgblight.md) or [RGB Matrix](feature_rgb_matrix.md) feature with the `apa102` driver set, and you would use those APIs instead.
  5. However, if you need to use the driver standalone, add the following to your `rules.mk`:
  6. ```make
  7. APA102_DRIVER_REQUIRED = yes
  8. ```
  9. You can then call the APA102 API by including `apa102.h` in your code.
  10. ## Basic Configuration :id=basic-configuration
  11. Add the following to your `config.h`:
  12. |Define |Default |Description |
  13. |---------------------------|-------------|------------------------------------------------------------------|
  14. |`APA102_DI_PIN` |*Not defined*|The GPIO pin connected to the DI pin of the first LED in the chain|
  15. |`APA102_CI_PIN` |*Not defined*|The GPIO pin connected to the CI pin of the first LED in the chain|
  16. |`APA102_DEFAULT_BRIGHTNESS`|`31` |The default global brightness level of the LEDs, from 0 to 31 |
  17. ## API :id=api
  18. ### `void apa102_setleds(rgb_led_t *start_led, uint16_t num_leds)`
  19. Send RGB data to the APA102 LED chain.
  20. #### Arguments :id=api-apa102-setleds-arguments
  21. - `rgb_led_t *start_led`
  22. A pointer to the LED array.
  23. - `uint16_t num_leds`
  24. The length of the LED array.
  25. ---
  26. ### `void apa102_set_brightness(uint8_t brightness)`
  27. Set the global brightness.
  28. #### Arguments :id=api-apa102-set-brightness-arguments
  29. - `uint8_t brightness`
  30. The brightness level to set, from 0 to 31.