void spinner_deactivate( spinner* spin ) { if( spin == 0 ) { return; } if( spin->fast_up_timer != 0 ) { app_timer_cancel_event( spin->ctx, spin->fast_up_timer ); } if( spin->fast_down_timer != 0 ) { app_timer_cancel_event( spin->ctx, spin->fast_down_timer ); } timer_stack_pop(); }
// ---------------------------------------------------------------------------- // handle_timer() // // The following section of code handles despatching timer ticks to the // program splash page handler until the maximum number of required ticks // is reached or the user pushes any key, at which time the splash page // processing is aborted. This is signaled by setting the tf_skip_start // flag in the Splash Page Window click handlers. // // Note: This section should probably me moved off to the page_start.c // module and serviced by a call from handle_timer() to // that module. // ---------------------------------------------------------------------------- void handle_timer(AppContextRef ctx, AppTimerHandle handle, uint32_t cookie) { app_timer_cancel_event(tf_app_context, tf_timer); // no more ticks, please if(tf_splash_done) { // error handler in case we miss a timer tick return; } if((tf_skip_start) && !(tf_splash_done)) { // flag set by click handlers in page_start module finish_splash_page(); return; } // else we be animating... if(tf_tick_count < NUMBER_OF_IMAGES) { // animate graphics page_start_tick(tf_tick_count++); tf_timer = app_timer_send_event(tf_app_context, 250, 42); } else if(tf_tick_count < (NUMBER_OF_IMAGES + 3)) { // animate graphics page_start_tick(tf_tick_count++); tf_timer = app_timer_send_event(tf_app_context, 1200, 42); } else { finish_splash_page(); // clean up & display program menu window } } // handle_timer()
/* * Clear existing timers */ void clear_timers() { for (int i=0; i < (MAX_EVENTS * 2); i++) { if (g_timer_rec[i].active) { g_timer_rec[i].active = false; app_timer_cancel_event(g_app_context, g_timer_rec[i].handle); } } }
void find_tempo_win_disappear( Window* win ) { if( measuring_tempo ) { app_timer_cancel_event( my_ctx, stop_measuring_timer ); } hw_timer_deinit(); timer_stack_pop(); }
void stop_timer(){ started = false; display_title_and_time(); if (update_timer != APP_TIMER_INVALID_HANDLE){ if(app_timer_cancel_event(app, update_timer)) { update_timer = APP_TIMER_INVALID_HANDLE; } } }
void handle_run_click( ClickRecognizerRef recognizer, Window* win ) { running = ! running; text_layer_set_text( &run_layer, ( running ? "stop" : "start" ) ); if( running ) { num_beats = 0; beat(); } else { app_timer_cancel_event( my_ctx, beat_timer ); } }
void select_single_click_handler(ClickRecognizerRef recognizer, Window *window) { (void)recognizer; (void)window; on = !on; if (on) { timer_handle = app_timer_send_event(app_ctx, 100 /* milliseconds */, COOKIE); } else { app_timer_cancel_event(app_ctx, timer_handle); } layer_mark_dirty(&bars_layer); }
void reschedule_locTimer() { if (locTimer) app_timer_cancel_event(app, locTimer); // schedule the next update based on zoom level uint32_t poll; if (zoom < 5) { poll = 600e3; } else if (zoom < 10) { poll = 60e3; } else if (zoom < 14) { poll = 15e3; } else { poll = 7e3; } locTimer = app_timer_send_event(app, poll, 0); }
void set_timer(AppContextRef ctx) { /*app_timer_send_event(ctx, 1800000, 1); // if these are ms, then is this 30 min, rather than 15 min?*/ // just trying something: if(timerHandle != APP_TIMER_INVALID_HANDLE) { // likely that we already have a timer scheduled. cancel it first bool result = app_timer_cancel_event(ctx, timerHandle); if(result == false) { // there was either no timer to cancel, or something went wrong. // nevertheless, do nothing for now. } timerHandle = APP_TIMER_INVALID_HANDLE; } AppTimerHandle _timerHandle = app_timer_send_event(ctx, 300000, 1); // 5 min. if(_timerHandle != APP_TIMER_INVALID_HANDLE) { timerHandle = _timerHandle; } }
void stop_timer() { app_timer_cancel_event(app_context, timerHandle); isRunning = false; maxTimeReached = true; }
void spinner_long_down_release_handler( ClickRecognizerRef recognizer, void* ctx ) { spinner* spin = (spinner*) ctx; app_timer_cancel_event( spin->ctx, spin->fast_down_timer ); }
/* * Timer handling. Includes a hold off for a period of time if there is resource contention */ void handle_calendar_timer(AppContextRef app_ctx, AppTimerHandle handle, uint32_t cookie) { // If we're rotating the visible event, get on with it. Slower overnight to save power if (cookie == ROTATE_EVENT) { // Clobber the timer app_timer_cancel_event(app_ctx, handle); // Show next event show_next_event(); // Kick off new timer if (is_overnight()) app_timer_send_event(app_ctx, ROTATE_EVENT_INTERVAL_OVERNIGHT_MS, cookie); else app_timer_send_event(app_ctx, ROTATE_EVENT_INTERVAL_MS, cookie); // Retire from active duty return; } // Show the alert and let the world know if (cookie >= ALERT_EVENT && cookie <= (ALERT_EVENT + (MAX_EVENTS * 2))) { app_timer_cancel_event(app_ctx, handle); int num = cookie - ALERT_EVENT; if (g_timer_rec[num].active == false) return; // Already had the data for this event deleted - cannot show it. g_timer_rec[num].active = false; g_showing_alert = true; set_event_display(g_timer_rec[num].event_desc, g_timer_rec[num].relative_desc, g_timer_rec[num].location, 0); set_invert_when_showing_event(true); app_timer_send_event(app_ctx, 30000, RESTORE_DATE); app_timer_send_event(app_ctx, 15000, SECOND_ALERT); vibes_double_pulse(); light_enable_interaction(); return; } // Let us know again if (cookie == SECOND_ALERT) { app_timer_cancel_event(app_ctx, handle); vibes_double_pulse(); light_enable_interaction(); return; } // Put the date back into the display area if (cookie == RESTORE_DATE) { app_timer_cancel_event(app_ctx, handle); g_showing_alert = false; show_next_event(); set_invert_when_showing_event(false); return; } // Fire the calendar request if (cookie == REQUEST_CALENDAR_KEY) { app_timer_cancel_event(app_ctx, handle); calendar_request(); } }
void stop_gap_timer() { app_timer_cancel_event(ctxRef, gapTimerHandle); }