diff options
author | Joy Lee <joylee.lc@foxmail.com> | 2022-08-14 09:09:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-13 18:09:57 -0700 |
commit | 6b1c7d20aadf40655585df465c4680eca5eca7ae (patch) | |
tree | 4dff447038879b3bf82cc2ea9a96710628daad75 /platforms/chibios | |
parent | 5c805e4cc5061f8b36216f25c6d17765408e2b02 (diff) |
Added ws2812_spi support for WB32 MCU (#17143)
Co-authored-by: Joy <chang.li@westberrytech.com>
Diffstat (limited to 'platforms/chibios')
-rw-r--r-- | platforms/chibios/drivers/ws2812.c | 2 | ||||
-rw-r--r-- | platforms/chibios/drivers/ws2812_spi.c | 13 |
2 files changed, 13 insertions, 2 deletions
diff --git a/platforms/chibios/drivers/ws2812.c b/platforms/chibios/drivers/ws2812.c index 1b3bb59842..55ac333b1e 100644 --- a/platforms/chibios/drivers/ws2812.c +++ b/platforms/chibios/drivers/ws2812.c @@ -6,7 +6,7 @@ /* Adapted from https://github.com/bigjosh/SimpleNeoPixelDemo/ */ #ifndef NOP_FUDGE -# if defined(STM32F0XX) || defined(STM32F1XX) || defined(GD32VF103) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX) +# if defined(STM32F0XX) || defined(STM32F1XX) || defined(GD32VF103) || defined(STM32F3XX) || defined(STM32F4XX) || defined(STM32L0XX) || defined(WB32F3G71xx) || defined(WB32FQ95xx) # define NOP_FUDGE 0.4 # else # error("NOP_FUDGE configuration required") diff --git a/platforms/chibios/drivers/ws2812_spi.c b/platforms/chibios/drivers/ws2812_spi.c index 01d8148875..9ee552b187 100644 --- a/platforms/chibios/drivers/ws2812_spi.c +++ b/platforms/chibios/drivers/ws2812_spi.c @@ -5,7 +5,11 @@ // Define the spi your LEDs are plugged to here #ifndef WS2812_SPI -# define WS2812_SPI SPID1 +# if defined(WB32F3G71xx) || defined(WB32FQ95xx) +# define WS2812_SPI SPIDQ +# else +# define WS2812_SPI SPID1 +# endif #endif #ifndef WS2812_SPI_MOSI_PAL_MODE @@ -54,6 +58,7 @@ # 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 +# define WS2812_SPI_DIVISOR 16 #endif // Use SPI circular buffer @@ -148,8 +153,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 |