src/drivers/rgbled/rgbled.cpp
/**
 * Send RGB PWM settings to LED driver according to current color and brightness
 */
Send RGB PWM settings to LED driver according to current color and brightness
Send RGB PWM settings to LED driver according to current color and brightness
int
RGBLED::send_led_rgb()
{
	const uint8_t msg[6] = {
		SUB_ADDR_PWM0, (uint8_t)((int)(_b * _brightness) >> 4),
		SUB_ADDR_PWM1, (uint8_t)((int)(_g * _brightness) >> 4),
		SUB_ADDR_PWM2, (uint8_t)((int)(_r * _brightness) >> 4)
	};
	return transfer(msg, sizeof(msg), nullptr, 0);
}
int RGBLED :: send_led_rgb ( ) { const uint8_t msg [ 6 ] = { SUB_ADDR_PWM0 , ( uint8_t ) ( ( int ) ( _b * _brightness ) >> 4 ) , SUB_ADDR_PWM1 , ( uint8_t ) ( ( int ) ( _g * _brightness ) >> 4 ) , SUB_ADDR_PWM2 , ( uint8_t ) ( ( int ) ( _r * _brightness ) >> 4 ) } ; return transfer ( msg , sizeof ( msg ) , nullptr , 0 ) ; }
Send RGB PWM settings to LED driver according to current color and brightness
Send RGB PWM settings to LED driver according to current color and brightness
/* To scale from 0..255 -> 0..15 shift right by 4 bits */