diff options
Diffstat (limited to 'drivers/avr/ws2812.c')
| -rw-r--r-- | drivers/avr/ws2812.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/drivers/avr/ws2812.c b/drivers/avr/ws2812.c index 5c733c4ab..dc7e8d48a 100644 --- a/drivers/avr/ws2812.c +++ b/drivers/avr/ws2812.c | |||
| @@ -36,7 +36,6 @@ | |||
| 36 | void ws2812_sendarray(uint8_t *array, uint16_t length); | 36 | void ws2812_sendarray(uint8_t *array, uint16_t length); |
| 37 | void ws2812_sendarray_mask(uint8_t *array, uint16_t length, uint8_t pinmask); | 37 | void ws2812_sendarray_mask(uint8_t *array, uint16_t length, uint8_t pinmask); |
| 38 | 38 | ||
| 39 | |||
| 40 | #ifdef RGBW_BB_TWI | 39 | #ifdef RGBW_BB_TWI |
| 41 | 40 | ||
| 42 | // Port for the I2C | 41 | // Port for the I2C |
| @@ -146,16 +145,6 @@ void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) { | |||
| 146 | } | 145 | } |
| 147 | 146 | ||
| 148 | void inline ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask) { | 147 | void inline ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask) { |
| 149 | // ws2812_DDRREG |= pinmask; // Enable DDR | ||
| 150 | // new universal format (DDR) | ||
| 151 | _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= pinmask; | ||
| 152 | |||
| 153 | ws2812_sendarray_mask((uint8_t *)ledarray, leds + leds + leds, pinmask); | ||
| 154 | _delay_us(50); | ||
| 155 | } | ||
| 156 | |||
| 157 | // Setleds for SK6812RGBW | ||
| 158 | void inline ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds) { | ||
| 159 | #ifdef RGBW_BB_TWI | 148 | #ifdef RGBW_BB_TWI |
| 160 | uint8_t sreg_prev, twcr_prev; | 149 | uint8_t sreg_prev, twcr_prev; |
| 161 | sreg_prev = SREG; | 150 | sreg_prev = SREG; |
| @@ -176,15 +165,18 @@ void inline ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds) { | |||
| 176 | SREG = sreg_prev; | 165 | SREG = sreg_prev; |
| 177 | TWCR = twcr_prev; | 166 | TWCR = twcr_prev; |
| 178 | #endif | 167 | #endif |
| 179 | 168 | // ws2812_DDRREG |= pinmask; // Enable DDR | |
| 180 | // ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR | ||
| 181 | // new universal format (DDR) | 169 | // new universal format (DDR) |
| 182 | _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= _BV(RGB_DI_PIN & 0xF); | 170 | _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= pinmask; |
| 183 | 171 | ||
| 184 | ws2812_sendarray_mask((uint8_t *)ledarray, leds << 2, _BV(RGB_DI_PIN & 0xF)); | 172 | ws2812_sendarray_mask((uint8_t *)ledarray, leds * sizeof(LED_TYPE), pinmask); |
| 185 | 173 | ||
| 186 | #ifndef RGBW_BB_TWI | 174 | #ifndef RGBW_BB_TWI |
| 175 | # ifdef RGBW | ||
| 187 | _delay_us(80); | 176 | _delay_us(80); |
| 177 | # else | ||
| 178 | _delay_us(50); | ||
| 179 | # endif | ||
| 188 | #endif | 180 | #endif |
| 189 | } | 181 | } |
| 190 | 182 | ||
