adafruit / Adafruit_nRF52_Bootloader

USB-enabled bootloaders for the nRF52 BLE SoC chips
MIT License
438 stars 393 forks source link

add support for APA102 LEDs #192

Closed jamesadevine closed 3 years ago

jamesadevine commented 3 years ago

This PR adds support for AP102 LEDs.

The board I tested this on had no LEDs, so this PR also adds a macro for conditional compilation of PWM led code too.

I tested the following configuration in board.h:

#define LEDS_NUMBER             0
#define LED_APA102
#define LED_APA102_CLK          _PINNUM(0, 21)
#define LED_APA102_DATA         _PINNUM(0, 19)
#define LED_APA102_BRIGHTNESS   0x8
#define BOARD_RGB_BRIGHTNESS    0xffffffff
#define APA102_NUMBER           15

BOARD_RGB_BRIGHTNESS is set to max unit32_t so that colour information is not masked off. LED brightness is controlled per pixel on APA102s and relies upon the new macro LED_APA102_BRIGHTNESS which can be set to a maximum value of 0x1f.