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);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue