Advertisement
techmik

Untitled

Sep 30th, 2011
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.16 KB | None | 0 0
  1. static int set_light_always_on(struct light_device_t* dev,
  2.             struct light_state_t const* state)
  3. {
  4.     if (state->flashOnMS == 0 && state->flashOffMS == 0)
  5.     return 0;
  6.  
  7.     int brightness =  rgb_to_brightness(state);
  8.     int v = 0;
  9.     int ret = 0;
  10.     pthread_mutex_lock(&g_lock);
  11.  
  12.     if (brightness+state->color == 0 || brightness > 100) {
  13.         if (state->color & 0x00ffffff)
  14.             v = 1;
  15.     } else
  16.         v = 0;
  17.  
  18.     LOGI("color %u fm %u status %u is lit %u brightness", state->color, state->flashMode, v, (state->color & 0x00ffffff), brightness);
  19.     ret = write_int(LED_FILE, v);
  20.     pthread_mutex_unlock(&g_lock);
  21.     return ret;
  22. }
  23.  
  24. static int set_light_notifications(struct light_device_t* dev,
  25.             struct light_state_t const* state)
  26. {
  27.     int brightness =  rgb_to_brightness(state);
  28.     int v = 0;
  29.     int ret = 0;
  30.     pthread_mutex_lock(&g_lock);
  31.  
  32.     if (brightness+state->color == 0 || brightness > 100) {
  33.         if (state->color & 0x00ffffff)
  34.             v = 1;
  35.     } else
  36.         v = 0;
  37.  
  38.     LOGI("color %u fm %u status %u is lit %u brightness", state->color, state->flashMode, v, (state->color & 0x00ffffff), brightness);
  39.     ret = write_int(LED_FILE, v);
  40.     pthread_mutex_unlock(&g_lock);
  41.     return ret;
  42. }
  43.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement