diff options
Diffstat (limited to 'quantum/light_ws2812.c')
-rwxr-xr-x | quantum/light_ws2812.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/quantum/light_ws2812.c b/quantum/light_ws2812.c index d38dac4c6..497543339 100755 --- a/quantum/light_ws2812.c +++ b/quantum/light_ws2812.c | |||
@@ -152,11 +152,6 @@ void inline ws2812_setleds_pin(struct cRGB *ledarray, uint16_t leds, uint8_t pin | |||
152 | // Setleds for SK6812RGBW | 152 | // Setleds for SK6812RGBW |
153 | void inline ws2812_setleds_rgbw(struct cRGBW *ledarray, uint16_t leds) | 153 | void inline ws2812_setleds_rgbw(struct cRGBW *ledarray, uint16_t leds) |
154 | { | 154 | { |
155 | // ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR | ||
156 | // new universal format (DDR) | ||
157 | _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= _BV(RGB_DI_PIN & 0xF); | ||
158 | |||
159 | ws2812_sendarray_mask((uint8_t*)ledarray,leds<<2,_BV(RGB_DI_PIN & 0xF)); | ||
160 | 155 | ||
161 | #ifdef RGBW_BB_TWI | 156 | #ifdef RGBW_BB_TWI |
162 | cli(); | 157 | cli(); |
@@ -169,14 +164,23 @@ void inline ws2812_setleds_rgbw(struct cRGBW *ledarray, uint16_t leds) | |||
169 | uint8_t * data = (uint8_t*)ledarray; | 164 | uint8_t * data = (uint8_t*)ledarray; |
170 | while (datlen--) { | 165 | while (datlen--) { |
171 | curbyte=*data++; | 166 | curbyte=*data++; |
172 | I2C_Write(curbyte % 0x10); | 167 | I2C_Write(curbyte); |
173 | } | 168 | } |
174 | I2C_Stop(); | 169 | I2C_Stop(); |
175 | sei(); | 170 | sei(); |
171 | #else | ||
172 | _delay_us(80); | ||
176 | #endif | 173 | #endif |
177 | 174 | ||
178 | 175 | ||
179 | _delay_us(80); | 176 | // ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR |
177 | // new universal format (DDR) | ||
178 | _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= _BV(RGB_DI_PIN & 0xF); | ||
179 | |||
180 | ws2812_sendarray_mask((uint8_t*)ledarray,leds<<2,_BV(RGB_DI_PIN & 0xF)); | ||
181 | |||
182 | |||
183 | |||
180 | } | 184 | } |
181 | 185 | ||
182 | void ws2812_sendarray(uint8_t *data,uint16_t datlen) | 186 | void ws2812_sendarray(uint8_t *data,uint16_t datlen) |
@@ -258,7 +262,7 @@ void inline ws2812_sendarray_mask(uint8_t *data,uint16_t datlen,uint8_t maskhi) | |||
258 | cli(); | 262 | cli(); |
259 | 263 | ||
260 | while (datlen--) { | 264 | while (datlen--) { |
261 | curbyte=(*data++) % 0x10; | 265 | curbyte=(*data++); |
262 | 266 | ||
263 | asm volatile( | 267 | asm volatile( |
264 | " ldi %0,8 \n\t" | 268 | " ldi %0,8 \n\t" |