return set_light_leds(state, 0);
}
+static int set_light_battery(struct light_device_t *dev,
+ struct light_state_t const *state)
+{
+ struct led_config led;
+ int brightness = rgb_to_brightness(state);
+ unsigned int colorRGB;
+
+ colorRGB = state->color;
+
+ if (brightness == 0) {
+ led.red = 0;
+ led.green = 0;
+ led.blue = 0;
+ snprintf(led.blink, MAX_WRITE_CMD, "0x000000 0 0");
+ } else {
+ led.red = (colorRGB >> 16) & 0xFF;
+ led.green = (colorRGB >> 8) & 0xFF;
+ led.blue = colorRGB & 0xFF;
+ snprintf(led.blink, MAX_WRITE_CMD, "0x%x %d %d", colorRGB, state->flashOnMS, state->flashOffMS);
+ }
+
+ return write_leds(led);
+}
+
static int set_light_leds_attention(struct light_device_t *dev,
struct light_state_t const *state)
{
set_light = set_light_leds_notifications;
else if (0 == strcmp(LIGHT_ID_ATTENTION, name))
set_light = set_light_leds_attention;
+ else if (0 == strcmp(LIGHT_ID_BATTERY, name))
+ set_light = set_light_battery;
else
return -EINVAL;