diff options
Diffstat (limited to 'platforms/chibios/drivers/ws2812_spi.c')
-rw-r--r-- | platforms/chibios/drivers/ws2812_spi.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/platforms/chibios/drivers/ws2812_spi.c b/platforms/chibios/drivers/ws2812_spi.c index 01d8148875..a73eb69720 100644 --- a/platforms/chibios/drivers/ws2812_spi.c +++ b/platforms/chibios/drivers/ws2812_spi.c @@ -16,6 +16,10 @@ # define WS2812_SPI_SCK_PAL_MODE 5 #endif +#ifndef WS2812_SPI_DIVISOR +# define WS2812_SPI_DIVISOR 16 +#endif + // Push Pull or Open Drain Configuration // Default Push Pull #ifndef WS2812_EXTERNAL_PULLUP @@ -42,7 +46,7 @@ # define WS2812_SPI_DIVISOR_CR1_BR_X (SPI_CR1_BR_0) #elif WS2812_SPI_DIVISOR == 8 # define WS2812_SPI_DIVISOR_CR1_BR_X (SPI_CR1_BR_1) -#elif WS2812_SPI_DIVISOR == 16 // same as default +#elif WS2812_SPI_DIVISOR == 16 // default # define WS2812_SPI_DIVISOR_CR1_BR_X (SPI_CR1_BR_1 | SPI_CR1_BR_0) #elif WS2812_SPI_DIVISOR == 32 # define WS2812_SPI_DIVISOR_CR1_BR_X (SPI_CR1_BR_2) @@ -53,7 +57,7 @@ #elif WS2812_SPI_DIVISOR == 256 # define WS2812_SPI_DIVISOR_CR1_BR_X (SPI_CR1_BR_2 | SPI_CR1_BR_1 | SPI_CR1_BR_0) #else -# define WS2812_SPI_DIVISOR_CR1_BR_X (SPI_CR1_BR_1 | SPI_CR1_BR_0) // default +# error "Configured WS2812_SPI_DIVISOR value is not supported at this time." #endif // Use SPI circular buffer @@ -148,8 +152,14 @@ void ws2812_init(void) { NULL, // end_cb PAL_PORT(RGB_DI_PIN), PAL_PAD(RGB_DI_PIN), +# if defined(WB32F3G71xx) || defined(WB32FQ95xx) + 0, + 0, + WS2812_SPI_DIVISOR +# else WS2812_SPI_DIVISOR_CR1_BR_X, 0 +# endif #else // HAL_SPI_V2 # if SPI_SUPPORTS_CIRCULAR == TRUE |