* units to step when in/decreasing saturation
* `#define RGBLIGHT_VAL_STEP 12`
* units to step when in/decreasing value (brightness)
-* `#define RGBW_BB_TWI`
- * bit-bangs TWI to EZ RGBW LEDs (only required for Ergodox EZ)
+* `#define RGBW`
+ * Enables RGBW LED support
## Mouse Key Options
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
-}
* 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);
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
}
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;
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
}
* 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);
#include "ws2812.h"
#include "i2c_master.h"
+#ifdef RGBW
+# error "RGBW not supported"
+#endif
+
#ifndef WS2812_ADDRESS
# define WS2812_ADDRESS 0xb0
#endif
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
-}
led[i].r = r;
led[i].g = g;
led[i].b = b;
+# ifdef RGBW
+ led[i].w = 0;
+# endif
}
static void setled_all(uint8_t r, uint8_t g, uint8_t b) {
(*led1).r = r;
(*led1).g = g;
(*led1).b = b;
+#ifdef RGBW
+ (*led1).w = 0;
+#endif
}
void rgblight_check_config(void) {
led[i].r = r;
led[i].g = g;
led[i].b = b;
+#ifdef RGBW
+ led[i].w = 0;
+#endif
}
rgblight_set();
}
led[index].r = r;
led[index].g = g;
led[index].b = b;
+#ifdef RGBW
+ led[index].w = 0;
+#endif
rgblight_set();
}
led[i].r = r;
led[i].g = g;
led[i].b = b;
+#ifdef RGBW
+ led[i].w = 0;
+#endif
}
rgblight_set();
wait_ms(1);
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
+# ifdef RGBW
+ led[i].w = 0;
+# endif
}
}
# ifdef RGBLIGHT_LED_MAP
# else
start_led = led + clipping_start_pos;
# endif
-# ifdef RGBW
- ws2812_setleds_rgbw(start_led, num_leds);
-# else
ws2812_setleds(start_led, num_leds);
-# endif
}
#endif
ledp->r = 0;
ledp->g = 0;
ledp->b = 0;
+# ifdef RGBW
+ ledp->w = 0;
+# endif
for (j = 0; j < RGBLIGHT_EFFECT_SNAKE_LENGTH; j++) {
k = pos + j * increment;
if (k > RGBLED_NUM) {
led[i].r = 0;
led[i].g = 0;
led[i].b = 0;
+# ifdef RGBW
+ led[i].w = 0;
+# endif
}
// Determine which LEDs should be lit up
for (i = 0; i < RGBLIGHT_EFFECT_KNIGHT_LED_NUM; i++) {
led[cur].r = 0;
led[cur].g = 0;
led[cur].b = 0;
+# ifdef RGBW
+ led[cur].w = 0;
+# endif
}
}
rgblight_set();