Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static int set_light_always_on(struct light_device_t* dev,
- struct light_state_t const* state)
- {
- if (state->flashOnMS == 0 && state->flashOffMS == 0)
- return 0;
- int brightness = rgb_to_brightness(state);
- int v = 0;
- int ret = 0;
- pthread_mutex_lock(&g_lock);
- if (brightness+state->color == 0 || brightness > 100) {
- if (state->color & 0x00ffffff)
- v = 1;
- } else
- v = 0;
- LOGI("color %u fm %u status %u is lit %u brightness", state->color, state->flashMode, v, (state->color & 0x00ffffff), brightness);
- ret = write_int(LED_FILE, v);
- pthread_mutex_unlock(&g_lock);
- return ret;
- }
- static int set_light_notifications(struct light_device_t* dev,
- struct light_state_t const* state)
- {
- int brightness = rgb_to_brightness(state);
- int v = 0;
- int ret = 0;
- pthread_mutex_lock(&g_lock);
- if (brightness+state->color == 0 || brightness > 100) {
- if (state->color & 0x00ffffff)
- v = 1;
- } else
- v = 0;
- LOGI("color %u fm %u status %u is lit %u brightness", state->color, state->flashMode, v, (state->color & 0x00ffffff), brightness);
- ret = write_int(LED_FILE, v);
- pthread_mutex_unlock(&g_lock);
- return ret;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement