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); }
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); } }