src/drivers/rgbled/rgbled.cpp
/**
 * Parse color constant and set _r _g _b values
 */
Parse color constant and set _r _g _b values
Parse color constant and set _r _g _b values
void
RGBLED::set_color(rgbled_color_t color)
{
	switch (color) {
	case RGBLED_COLOR_OFF:
		_r = 0;
		_g = 0;
		_b = 0;
		break;
	case RGBLED_COLOR_RED:
		_r = 255;
		_g = 0;
		_b = 0;
		break;
	case RGBLED_COLOR_YELLOW:
		_r = 255;
		_g = 200;
		_b = 0;
		break;
	case RGBLED_COLOR_PURPLE:
		_r = 255;
		_g = 0;
		_b = 255;
		break;
	case RGBLED_COLOR_GREEN:
		_r = 0;
		_g = 255;
		_b = 0;
		break;
	case RGBLED_COLOR_BLUE:
		_r = 0;
		_g = 0;
		_b = 255;
		break;
	case RGBLED_COLOR_WHITE:
		_r = 255;
		_g = 255;
		_b = 255;
		break;
	case RGBLED_COLOR_AMBER:
		_r = 255;
		_g = 80;
		_b = 0;
		break;
	case RGBLED_COLOR_DIM_RED:
		_r = 90;
		_g = 0;
		_b = 0;
		break;
	case RGBLED_COLOR_DIM_YELLOW:
		_r = 80;
		_g = 30;
		_b = 0;
		break;
	case RGBLED_COLOR_DIM_PURPLE:
		_r = 45;
		_g = 0;
		_b = 45;
		break;
	case RGBLED_COLOR_DIM_GREEN:
		_r = 0;
		_g = 90;
		_b = 0;
		break;
	case RGBLED_COLOR_DIM_BLUE:
		_r = 0;
		_g = 0;
		_b = 90;
		break;
	case RGBLED_COLOR_DIM_WHITE:
		_r = 30;
		_g = 30;
		_b = 30;
		break;
	case RGBLED_COLOR_DIM_AMBER:
		_r = 80;
		_g = 20;
		_b = 0;
		break;
	default:
		warnx("color unknown");
		break;
	}
}
void RGBLED :: set_color ( rgbled_color_t color ) { switch ( color ) { case RGBLED_COLOR_OFF : _r = 0 ; _g = 0 ; _b = 0 ; break ; case RGBLED_COLOR_RED : _r = 255 ; _g = 0 ; _b = 0 ; break ; case RGBLED_COLOR_YELLOW : _r = 255 ; _g = 200 ; _b = 0 ; break ; case RGBLED_COLOR_PURPLE : _r = 255 ; _g = 0 ; _b = 255 ; break ; case RGBLED_COLOR_GREEN : _r = 0 ; _g = 255 ; _b = 0 ; break ; case RGBLED_COLOR_BLUE : _r = 0 ; _g = 0 ; _b = 255 ; break ; case RGBLED_COLOR_WHITE : _r = 255 ; _g = 255 ; _b = 255 ; break ; case RGBLED_COLOR_AMBER : _r = 255 ; _g = 80 ; _b = 0 ; break ; case RGBLED_COLOR_DIM_RED : _r = 90 ; _g = 0 ; _b = 0 ; break ; case RGBLED_COLOR_DIM_YELLOW : _r = 80 ; _g = 30 ; _b = 0 ; break ; case RGBLED_COLOR_DIM_PURPLE : _r = 45 ; _g = 0 ; _b = 45 ; break ; case RGBLED_COLOR_DIM_GREEN : _r = 0 ; _g = 90 ; _b = 0 ; break ; case RGBLED_COLOR_DIM_BLUE : _r = 0 ; _g = 0 ; _b = 90 ; break ; case RGBLED_COLOR_DIM_WHITE : _r = 30 ; _g = 30 ; _b = 30 ; break ; case RGBLED_COLOR_DIM_AMBER : _r = 80 ; _g = 20 ; _b = 0 ; break ; default : warnx ( " " ) ; break ; } }
Parse color constant and set _r _g _b values
Parse color constant and set _r _g _b values