summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/arm/ws2812.c11
-rw-r--r--drivers/arm/ws2812.h3
-rw-r--r--drivers/avr/ws2812.c22
-rw-r--r--drivers/avr/ws2812.h3
-rw-r--r--drivers/avr/ws2812_i2c.c12
5 files changed, 16 insertions, 35 deletions
diff --git a/drivers/arm/ws2812.c b/drivers/arm/ws2812.c
index b076eff330..fa702fca98 100644
--- a/drivers/arm/ws2812.c
+++ b/drivers/arm/ws2812.c
@@ -84,17 +84,12 @@ void ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) {
sendByte(ledarray[i].g);
sendByte(ledarray[i].r);
sendByte(ledarray[i].b);
+#ifdef RGBW
+ sendByte(ledarray[i].w);
+#endif
}
wait_ns(RES);
chSysUnlock();
}
-
-// Setleds for SK6812RGBW
-void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds) {
-// not supported - for now error out if its enabled
-#ifdef RGBW
-# error "RGBW not supported"
-#endif
-}
diff --git a/drivers/arm/ws2812.h b/drivers/arm/ws2812.h
index bf5c9fd0f1..41c22a00b8 100644
--- a/drivers/arm/ws2812.h
+++ b/drivers/arm/ws2812.h
@@ -11,7 +11,6 @@
* The functions will perform the following actions:
* - Set the data-out pin as output
* - Send out the LED data
- * - Wait 50�s to reset the LEDs
+ * - Wait 50us to reset the LEDs
*/
void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds);
-void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds);
diff --git a/drivers/avr/ws2812.c b/drivers/avr/ws2812.c
index 5c733c4ab0..dc7e8d48a8 100644
--- a/drivers/avr/ws2812.c
+++ b/drivers/avr/ws2812.c
@@ -36,7 +36,6 @@
void ws2812_sendarray(uint8_t *array, uint16_t length);
void ws2812_sendarray_mask(uint8_t *array, uint16_t length, uint8_t pinmask);
-
#ifdef RGBW_BB_TWI
// Port for the I2C
@@ -146,16 +145,6 @@ void inline ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) {
}
void inline ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t leds, uint8_t pinmask) {
- // ws2812_DDRREG |= pinmask; // Enable DDR
- // new universal format (DDR)
- _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= pinmask;
-
- ws2812_sendarray_mask((uint8_t *)ledarray, leds + leds + leds, pinmask);
- _delay_us(50);
-}
-
-// Setleds for SK6812RGBW
-void inline ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds) {
#ifdef RGBW_BB_TWI
uint8_t sreg_prev, twcr_prev;
sreg_prev = SREG;
@@ -176,15 +165,18 @@ void inline ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds) {
SREG = sreg_prev;
TWCR = twcr_prev;
#endif
-
- // ws2812_DDRREG |= _BV(ws2812_pin); // Enable DDR
+ // ws2812_DDRREG |= pinmask; // Enable DDR
// new universal format (DDR)
- _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= _BV(RGB_DI_PIN & 0xF);
+ _SFR_IO8((RGB_DI_PIN >> 4) + 1) |= pinmask;
- ws2812_sendarray_mask((uint8_t *)ledarray, leds << 2, _BV(RGB_DI_PIN & 0xF));
+ ws2812_sendarray_mask((uint8_t *)ledarray, leds * sizeof(LED_TYPE), pinmask);
#ifndef RGBW_BB_TWI
+# ifdef RGBW
_delay_us(80);
+# else
+ _delay_us(50);
+# endif
#endif
}
diff --git a/drivers/avr/ws2812.h b/drivers/avr/ws2812.h
index 9652b94bbe..b869fb28c8 100644
--- a/drivers/avr/ws2812.h
+++ b/drivers/avr/ws2812.h
@@ -34,8 +34,7 @@
* The functions will perform the following actions:
* - Set the data-out pin as output
* - Send out the LED data
- * - Wait 50�s to reset the LEDs
+ * - Wait 50us to reset the LEDs
*/
void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds);
void ws2812_setleds_pin(LED_TYPE *ledarray, uint16_t number_of_leds, uint8_t pinmask);
-void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t number_of_leds);
diff --git a/drivers/avr/ws2812_i2c.c b/drivers/avr/ws2812_i2c.c
index 8525a026c7..1c332e24b6 100644
--- a/drivers/avr/ws2812_i2c.c
+++ b/drivers/avr/ws2812_i2c.c
@@ -1,6 +1,10 @@
#include "ws2812.h"
#include "i2c_master.h"
+#ifdef RGBW
+# error "RGBW not supported"
+#endif
+
#ifndef WS2812_ADDRESS
# define WS2812_ADDRESS 0xb0
#endif
@@ -21,11 +25,3 @@ void ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) {
i2c_transmit(WS2812_ADDRESS, (uint8_t *)ledarray, sizeof(LED_TYPE) * leds, WS2812_TIMEOUT);
}
-
-// Setleds for SK6812RGBW
-void ws2812_setleds_rgbw(LED_TYPE *ledarray, uint16_t leds) {
-// not supported - for now error out if its enabled
-#ifdef RGBW
-# error "RGBW not supported"
-#endif
-}