Clean up RGB LED type (#21859)
This commit is contained in:
parent
1e3095f9cc
commit
41bd4e35a0
63 changed files with 222 additions and 243 deletions
|
@ -37,13 +37,13 @@
|
|||
|
||||
static inline void ws2812_sendarray_mask(uint8_t *data, uint16_t datlen, uint8_t masklo, uint8_t maskhi);
|
||||
|
||||
void ws2812_setleds(LED_TYPE *ledarray, uint16_t number_of_leds) {
|
||||
void ws2812_setleds(rgb_led_t *ledarray, uint16_t number_of_leds) {
|
||||
DDRx_ADDRESS(WS2812_DI_PIN) |= pinmask(WS2812_DI_PIN);
|
||||
|
||||
uint8_t masklo = ~(pinmask(WS2812_DI_PIN)) & PORTx_ADDRESS(WS2812_DI_PIN);
|
||||
uint8_t maskhi = pinmask(WS2812_DI_PIN) | PORTx_ADDRESS(WS2812_DI_PIN);
|
||||
|
||||
ws2812_sendarray_mask((uint8_t *)ledarray, number_of_leds * sizeof(LED_TYPE), masklo, maskhi);
|
||||
ws2812_sendarray_mask((uint8_t *)ledarray, number_of_leds * sizeof(rgb_led_t), masklo, maskhi);
|
||||
|
||||
_delay_us(WS2812_TRST_US);
|
||||
}
|
||||
|
|
|
@ -18,12 +18,12 @@ void ws2812_init(void) {
|
|||
}
|
||||
|
||||
// Setleds for standard RGB
|
||||
void ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) {
|
||||
void ws2812_setleds(rgb_led_t *ledarray, uint16_t leds) {
|
||||
static bool s_init = false;
|
||||
if (!s_init) {
|
||||
ws2812_init();
|
||||
s_init = true;
|
||||
}
|
||||
|
||||
i2c_transmit(WS2812_I2C_ADDRESS, (uint8_t *)ledarray, sizeof(LED_TYPE) * leds, WS2812_I2C_TIMEOUT);
|
||||
i2c_transmit(WS2812_I2C_ADDRESS, (uint8_t *)ledarray, sizeof(rgb_led_t) * leds, WS2812_I2C_TIMEOUT);
|
||||
}
|
||||
|
|
|
@ -268,7 +268,7 @@ static inline void sync_ws2812_transfer(void) {
|
|||
busy_wait_until(LAST_TRANSFER);
|
||||
}
|
||||
|
||||
void ws2812_setleds(LED_TYPE* ledarray, uint16_t leds) {
|
||||
void ws2812_setleds(rgb_led_t* ledarray, uint16_t leds) {
|
||||
static bool is_initialized = false;
|
||||
if (unlikely(!is_initialized)) {
|
||||
is_initialized = ws2812_init();
|
||||
|
|
|
@ -72,7 +72,7 @@ void ws2812_init(void) {
|
|||
}
|
||||
|
||||
// Setleds for standard RGB
|
||||
void ws2812_setleds(LED_TYPE *ledarray, uint16_t leds) {
|
||||
void ws2812_setleds(rgb_led_t *ledarray, uint16_t leds) {
|
||||
static bool s_init = false;
|
||||
if (!s_init) {
|
||||
ws2812_init();
|
||||
|
|
|
@ -379,7 +379,7 @@ void ws2812_write_led_rgbw(uint16_t led_number, uint8_t r, uint8_t g, uint8_t b,
|
|||
}
|
||||
|
||||
// Setleds for standard RGB
|
||||
void ws2812_setleds(LED_TYPE* ledarray, uint16_t leds) {
|
||||
void ws2812_setleds(rgb_led_t* ledarray, uint16_t leds) {
|
||||
static bool s_init = false;
|
||||
if (!s_init) {
|
||||
ws2812_init();
|
||||
|
|
|
@ -106,7 +106,7 @@ static uint8_t get_protocol_eq(uint8_t data, int pos) {
|
|||
return eq;
|
||||
}
|
||||
|
||||
static void set_led_color_rgb(LED_TYPE color, int pos) {
|
||||
static void set_led_color_rgb(rgb_led_t color, int pos) {
|
||||
uint8_t* tx_start = &txbuf[PREAMBLE_SIZE];
|
||||
|
||||
#if (WS2812_BYTE_ORDER == WS2812_BYTE_ORDER_GRB)
|
||||
|
@ -187,7 +187,7 @@ void ws2812_init(void) {
|
|||
#endif
|
||||
}
|
||||
|
||||
void ws2812_setleds(LED_TYPE* ledarray, uint16_t leds) {
|
||||
void ws2812_setleds(rgb_led_t* ledarray, uint16_t leds) {
|
||||
static bool s_init = false;
|
||||
if (!s_init) {
|
||||
ws2812_init();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue