static inline void _rgb_l2c_set(int red, int green, int blue)
{
+ FUNCTION_START;
if (!s_info.use_rgb_l2c) {
_D("l2c rgb led is turned OFF");
return;
ret_error_message(ret != PERIPHERAL_ERROR_NONE, ret);
_D("RGB L2C: [%d, %d, %d] -> [%d, %d, %d]", red, green, blue, RGB_TO_REGISTER(red), RGB_TO_REGISTER(green), RGB_TO_REGISTER(blue));
+ FUNCTION_END;
}
static gboolean _restore_bi_color_cb(gpointer data)
static gboolean _restore_rgb_l2c_color_cb(gpointer data)
{
+ FUNCTION_START;
_rgb_l2c_set(s_info.current_rgb_l2c_color[0], s_info.current_rgb_l2c_color[1], s_info.current_rgb_l2c_color[2]);
+ FUNCTION_END;
return false;
}
static gboolean _restore_rgb_color_cb(gpointer data)
{
+ FUNCTION_START;
+
_restore_bi_color_cb(data);
_restore_rgb_gpio_color_cb(data);
_restore_rgb_l2c_color_cb(data);
+ FUNCTION_END;
+
return false;
}
config_save();
}
+ _D("Use bi_led: %d", s_info.use_bi_led);
+
+
if (s_info.use_bi_led) {
s_info.gpio_bi_led[LED_COLOR_RED] = _init_gpio(DEFAULT_BI_LED_RED, CONFIG_KEY_RPI_BI_LED_RED);
s_info.gpio_bi_led[LED_COLOR_GREEN] = _init_gpio(DEFAULT_BI_LED_GREEN, CONFIG_KEY_RPI_BI_LED_GREEN);
config_save();
}
+ _D("Use rgb_gpio_led: %d", s_info.use_rgb_gpio);
+
if (!s_info.use_rgb_gpio) {
_D("RGB GPIO is turned off");
return;
config_save();
}
+ _D("Use rgb_l2c_led: %d", s_info.use_rgb_l2c);
+
if (!s_info.use_rgb_l2c) {
_D("RGB L2C is turned off");
return;
void resource_led_init(void)
{
+ FUNCTION_START;
_D("Initialize Led");
_init_rgb_gpio_led();
_init_bi_led();
_init_rgb_l2c_led();
+ FUNCTION_END;
}
void resource_led_destroy(void)
{
_D("Set led to: %d", color);
if (color == s_info.current_color) {
+ _D("No change in bi led");
return;
}
void resource_led_bi_blink(bi_led_color_e color, unsigned timeout)
{
if (color == s_info.current_color) {
+ _D("No change in bi led");
return;
}
if (red == s_info.current_rgb_gpio_color[0] &&
green == s_info.current_rgb_gpio_color[1] &&
blue == s_info.current_rgb_gpio_color[2]) {
+ _D("No change in gpio led");
return;
}
if (red == s_info.current_rgb_gpio_color[0] &&
green == s_info.current_rgb_gpio_color[1] &&
blue == s_info.current_rgb_gpio_color[2]) {
+ _D("No change in gpio led");
return;
}
if (red == s_info.current_rgb_l2c_color[0] &&
green == s_info.current_rgb_l2c_color[1] &&
blue == s_info.current_rgb_l2c_color[2]) {
+ _D("No change in l2c led");
return;
}
if (red == s_info.current_rgb_l2c_color[0] &&
green == s_info.current_rgb_l2c_color[1] &&
blue == s_info.current_rgb_l2c_color[2]) {
+ _D("No change in l2c led");
return;
}
int def_r_24bit, int def_g_24bit, int def_b_24bit,
bi_led_color_e bi_led)
{
+ FUNCTION_START;
+
int red, green, blue;
char final_key[PATH_MAX];
if (modified) {
config_save();
}
+
_D("%s: bicolor: [%d]", final_key, value);
+
+ FUNCTION_END;
}
void resource_led_blink_rgb_colors(char *key,
int def_r_24bit, int def_g_24bit, int def_b_24bit,
bi_led_color_e bi_led, int timeout)
{
+ FUNCTION_START;
+
resource_led_set_rgb_colors(key, def_r_3bit, def_g_3bit, def_b_3bit, def_r_24bit, def_g_24bit, def_b_24bit, bi_led);
g_timeout_add(timeout, _restore_rgb_color_cb, NULL);
+
+
+ FUNCTION_END;
}