void init_rgb(void) { int rgb_pin = pgm_read_byte(&(rgb_pin_const)); int rgb_count = pgm_read_byte(&(rgb_count_const)); struct cRGB rgb_led[rgb_count]; for (int n=0; n<rgb_count; n++) { rgb_led[n].r = pgm_read_byte(&(rgb_led_const[n].r)); rgb_led[n].g = pgm_read_byte(&(rgb_led_const[n].g)); rgb_led[n].b = pgm_read_byte(&(rgb_led_const[n].b)); } ws2812_setleds_pin(rgb_led, rgb_count, rgb_pin); ws2812_setleds_pin(rgb_led, 1, rgb_pin); // timing is bugged for 1st LED after changes somewhere, probably compiler-side; this fixes it }
// Setleds for standard RGB void inline ws2812_setleds(struct cRGB *ledarray, uint16_t leds) { // ws2812_setleds_pin(ledarray,leds, _BV(ws2812_pin)); ws2812_setleds_pin(ledarray,leds, _BV(RGB_DI_PIN & 0xF)); }