}
static uint8_t led_data[NB_LEDS * 3];
-static int16_t max_led = -1;
+static uint16_t max_led = 0;
static uint32_t nb_bytes = 0;
return -1;
}
if (nb_leds == 0) {
- if (max_led == -1) {
- return 0;
- }
nb_leds = max_led;
- /* All leds set previously will be sent, back to no leds set */
- max_led = -1;
}
nb_bytes = (nb_leds + 1) * 3;
ws2812_bit_sender();
void ws2812_clear_buffer(void)
{
memset(led_data, 0, (NB_LEDS * 3));
- max_led = -1;
+ max_led = 0;
}
/* Clear the internal data buffer and send it to the Leds, turning them all off */
/* Start at first led and send all leds off */
ws2812_clear_buffer();
ws2812_send_frame(NB_LEDS);
- max_led = -1;
+ max_led = 0;
}
void ws2812_stop(void) __attribute__ ((alias ("ws2812_clear")));