From 47966dc2a65c88ac90fcd64d12243d72f3f6753b Mon Sep 17 00:00:00 2001 From: Ryan Date: Thu, 6 Apr 2023 18:00:54 +1000 Subject: Migrate `rgblight.pin` and `RGB_DI_PIN` to `ws2812.pin` (#20303) --- platforms/avr/drivers/ws2812_bitbang.c | 8 ++++---- platforms/chibios/boards/BONSAI_C4/configs/config.h | 4 ++-- platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c | 6 +++--- platforms/chibios/drivers/ws2812_bitbang.c | 10 +++++----- platforms/chibios/drivers/ws2812_pwm.c | 2 +- platforms/chibios/drivers/ws2812_spi.c | 10 +++++----- 6 files changed, 20 insertions(+), 20 deletions(-) (limited to 'platforms') diff --git a/platforms/avr/drivers/ws2812_bitbang.c b/platforms/avr/drivers/ws2812_bitbang.c index 5c0cb3b718..aad10d86b0 100644 --- a/platforms/avr/drivers/ws2812_bitbang.c +++ b/platforms/avr/drivers/ws2812_bitbang.c @@ -38,10 +38,10 @@ static inline void ws2812_sendarray_mask(uint8_t *data, uint16_t datlen, uint8_t masklo, uint8_t maskhi); void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds) { - DDRx_ADDRESS(RGB_DI_PIN) |= pinmask(RGB_DI_PIN); + DDRx_ADDRESS(WS2812_DI_PIN) |= pinmask(WS2812_DI_PIN); - uint8_t masklo = ~(pinmask(RGB_DI_PIN)) & PORTx_ADDRESS(RGB_DI_PIN); - uint8_t maskhi = pinmask(RGB_DI_PIN) | PORTx_ADDRESS(RGB_DI_PIN); + uint8_t masklo = ~(pinmask(WS2812_DI_PIN)) & PORTx_ADDRESS(WS2812_DI_PIN); + uint8_t maskhi = pinmask(WS2812_DI_PIN) | PORTx_ADDRESS(WS2812_DI_PIN); ws2812_sendarray_mask((uint8_t *)ledarray, number_of_leds * sizeof(LED_TYPE), masklo, maskhi); @@ -165,7 +165,7 @@ static inline void ws2812_sendarray_mask(uint8_t *data, uint16_t datlen, uint8_t " dec %0 \n\t" // '1' [+2] '0' [+2] " brne loop%=\n\t" // '1' [+3] '0' [+4] : "=&d"(ctr) - : "r"(curbyte), "I"(_SFR_IO_ADDR(PORTx_ADDRESS(RGB_DI_PIN))), "r"(maskhi), "r"(masklo)); + : "r"(curbyte), "I"(_SFR_IO_ADDR(PORTx_ADDRESS(WS2812_DI_PIN))), "r"(maskhi), "r"(masklo)); } SREG = sreg_prev; diff --git a/platforms/chibios/boards/BONSAI_C4/configs/config.h b/platforms/chibios/boards/BONSAI_C4/configs/config.h index e412f73d3d..c5dbb25c45 100644 --- a/platforms/chibios/boards/BONSAI_C4/configs/config.h +++ b/platforms/chibios/boards/BONSAI_C4/configs/config.h @@ -67,8 +67,8 @@ // WS2812-style LED control on pin A10 #ifdef WS2812_DRIVER_PWM -# ifndef RGB_DI_PIN -# define RGB_DI_PIN PAL_LINE(GPIOA, 10) +# ifndef WS2812_DI_PIN +# define WS2812_DI_PIN PAL_LINE(GPIOA, 10) # endif # ifndef WS2812_PWM_DRIVER # define WS2812_PWM_DRIVER PWMD1 diff --git a/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c b/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c index a46b099195..99a6cfaba9 100644 --- a/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c +++ b/platforms/chibios/drivers/vendor/RP/RP2040/ws2812_vendor.c @@ -185,7 +185,7 @@ bool ws2812_init(void) { (pio_idx == 0 ? PAL_MODE_ALTERNATE_PIO0 : PAL_MODE_ALTERNATE_PIO1); // clang-format on - palSetLineMode(RGB_DI_PIN, rgb_pin_mode); + palSetLineMode(WS2812_DI_PIN, rgb_pin_mode); STATE_MACHINE = pio_claim_unused_sm(pio, true); if (STATE_MACHINE < 0) { @@ -195,11 +195,11 @@ bool ws2812_init(void) { uint offset = pio_add_program(pio, &ws2812_program); - pio_sm_set_consecutive_pindirs(pio, STATE_MACHINE, RGB_DI_PIN, 1, true); + pio_sm_set_consecutive_pindirs(pio, STATE_MACHINE, WS2812_DI_PIN, 1, true); pio_sm_config config = pio_get_default_sm_config(); sm_config_set_wrap(&config, offset + WS2812_WRAP_TARGET, offset + WS2812_WRAP); - sm_config_set_sideset_pins(&config, RGB_DI_PIN); + sm_config_set_sideset_pins(&config, WS2812_DI_PIN); sm_config_set_fifo_join(&config, PIO_FIFO_JOIN_TX); #if defined(WS2812_EXTERNAL_PULLUP) diff --git a/platforms/chibios/drivers/ws2812_bitbang.c b/platforms/chibios/drivers/ws2812_bitbang.c index 55ac333b1e..d05deb1a50 100644 --- a/platforms/chibios/drivers/ws2812_bitbang.c +++ b/platforms/chibios/drivers/ws2812_bitbang.c @@ -53,22 +53,22 @@ void sendByte(uint8_t byte) { // using something like wait_ns(is_one ? T1L : T0L) here throws off timings if (is_one) { // 1 - writePinHigh(RGB_DI_PIN); + writePinHigh(WS2812_DI_PIN); wait_ns(WS2812_T1H); - writePinLow(RGB_DI_PIN); + writePinLow(WS2812_DI_PIN); wait_ns(WS2812_T1L); } else { // 0 - writePinHigh(RGB_DI_PIN); + writePinHigh(WS2812_DI_PIN); wait_ns(WS2812_T0H); - writePinLow(RGB_DI_PIN); + writePinLow(WS2812_DI_PIN); wait_ns(WS2812_T0L); } } } void ws2812_init(void) { - palSetLineMode(RGB_DI_PIN, WS2812_OUTPUT_MODE); + palSetLineMode(WS2812_DI_PIN, WS2812_OUTPUT_MODE); } // Setleds for standard RGB diff --git a/platforms/chibios/drivers/ws2812_pwm.c b/platforms/chibios/drivers/ws2812_pwm.c index c4a591c10b..04c8279a97 100644 --- a/platforms/chibios/drivers/ws2812_pwm.c +++ b/platforms/chibios/drivers/ws2812_pwm.c @@ -308,7 +308,7 @@ void ws2812_init(void) { for (i = 0; i < WS2812_RESET_BIT_N; i++) ws2812_frame_buffer[i + WS2812_COLOR_BIT_N] = 0; // All reset bits are zero - palSetLineMode(RGB_DI_PIN, WS2812_OUTPUT_MODE); + palSetLineMode(WS2812_DI_PIN, WS2812_OUTPUT_MODE); // PWM Configuration //#pragma GCC diagnostic ignored "-Woverride-init" // Turn off override-init warning for this struct. We use the overriding ability to set a "default" channel config diff --git a/platforms/chibios/drivers/ws2812_spi.c b/platforms/chibios/drivers/ws2812_spi.c index 03ffbd7f82..c28f5007f1 100644 --- a/platforms/chibios/drivers/ws2812_spi.c +++ b/platforms/chibios/drivers/ws2812_spi.c @@ -136,7 +136,7 @@ static void set_led_color_rgb(LED_TYPE color, int pos) { } void ws2812_init(void) { - palSetLineMode(RGB_DI_PIN, WS2812_MOSI_OUTPUT_MODE); + palSetLineMode(WS2812_DI_PIN, WS2812_MOSI_OUTPUT_MODE); #ifdef WS2812_SPI_SCK_PIN palSetLineMode(WS2812_SPI_SCK_PIN, WS2812_SCK_OUTPUT_MODE); @@ -150,8 +150,8 @@ void ws2812_init(void) { WS2812_SPI_BUFFER_MODE, # endif NULL, // end_cb - PAL_PORT(RGB_DI_PIN), - PAL_PAD(RGB_DI_PIN), + PAL_PORT(WS2812_DI_PIN), + PAL_PAD(WS2812_DI_PIN), # if defined(WB32F3G71xx) || defined(WB32FQ95xx) 0, 0, @@ -170,8 +170,8 @@ void ws2812_init(void) { # endif NULL, // data_cb NULL, // error_cb - PAL_PORT(RGB_DI_PIN), - PAL_PAD(RGB_DI_PIN), + PAL_PORT(WS2812_DI_PIN), + PAL_PAD(WS2812_DI_PIN), WS2812_SPI_DIVISOR_CR1_BR_X, 0 #endif -- cgit v1.2.3