예제 #1
0
파일: timer.c 프로젝트: Kfernand2/pebble
static void timer_completed_action(Timer* timer) {
  switch (timer->vibration) {
    case TIMER_VIBE_NONE:
      // Do nothing!
      break;
    case TIMER_VIBE_SHORT:
      vibes_short_pulse();
      break;
    case TIMER_VIBE_LONG:
      vibes_long_pulse();
      break;
    case TIMER_VIBE_DOUBLE: {
      const uint32_t seg[] = { 600, 200, 600 };
      VibePattern pattern = {
        .durations =  seg,
        .num_segments = ARRAY_LENGTH(seg)
      };
      vibes_enqueue_custom_pattern(pattern);
      break;
    }
    case TIMER_VIBE_TRIPLE: {
      const uint32_t seg[] = { 600, 200, 600, 200, 600 };
      VibePattern pattern = {
        .durations =  seg,
        .num_segments = ARRAY_LENGTH(seg)
      };
      vibes_enqueue_custom_pattern(pattern);
      break;
    }
    case TIMER_VIBE_SOLID:
      win_vibrate_show();
      break;
    default:
      break;
  }
  if (timer->repeat == TIMER_REPEAT_INFINITE) {
    timer_start(timer);
  }
  timers_highlight(timer);
}
예제 #2
0
파일: timer.c 프로젝트: sdoo12/multi-timer
static void timer_finished(Timer* timer) {
  timer->status = TIMER_STATUS_FINISHED;
  switch (timer->vibrate) {
    case TIMER_VIBRATION_OFF:
      // Do nothing!
    break;
    case TIMER_VIBRATION_SHORT:
      vibes_short_pulse();
    break;
    case TIMER_VIBRATION_LONG:
      vibes_long_pulse();
    break;
    case TIMER_VIBRATION_DOUBLE: {
      const uint32_t seg[] = { 600, 200, 600 };
      VibePattern pattern = {
        .durations =  seg,
        .num_segments = ARRAY_LENGTH(seg)
      };
      vibes_enqueue_custom_pattern(pattern);
    }
    break;
    case TIMER_VIBRATION_TRIPLE: {
      const uint32_t seg[] = { 600, 200, 600, 200, 600 };
      VibePattern pattern = {
        .durations =  seg,
        .num_segments = ARRAY_LENGTH(seg)
      };
      vibes_enqueue_custom_pattern(pattern);
    }
    break;
    case TIMER_VIBRATION_CONTINUOUS:
      if (! win_vibrate_is_visible()) {
        win_vibrate_show();
      }
    break;
  }
  if (timer->repeat) {
    timer_start(timer);
  }
}