Pebble Foundation Classes  0.2.0
C++ for Pebble

Can be used to execute some code at some point in the future. More...

Collaboration diagram for Timer:

Typedefs

typedef struct AppTimer AppTimer
 
typedef void(* AppTimerCallback) (void *data)
 
typedef struct AppTimer AppTimer
 
typedef void(* AppTimerCallback) (void *data)
 

Functions

void psleep (int millis)
 
AppTimer * app_timer_register (uint32_t timeout_ms, AppTimerCallback callback, void *callback_data)
 
bool app_timer_reschedule (AppTimer *timer_handle, uint32_t new_timeout_ms)
 
void app_timer_cancel (AppTimer *timer_handle)
 

Detailed Description

Can be used to execute some code at some point in the future.

Typedef Documentation

◆ AppTimerCallback [1/2]

typedef void(* AppTimerCallback) (void *data)

The type of function which can be called when a timer fires. The argument will be the callback_data passed to app_timer_register().

◆ AppTimerCallback [2/2]

typedef void(* AppTimerCallback) (void *data)

The type of function which can be called when a timer fires. The argument will be the callback_data passed to app_timer_register().

Function Documentation

◆ app_timer_cancel()

void app_timer_cancel ( AppTimer *  timer_handle)

Cancels an already registered timer. Once cancelled the handle may no longer be used for any purpose.

◆ app_timer_register()

AppTimer * app_timer_register ( uint32_t  timeout_ms,
AppTimerCallback  callback,
void *  callback_data 
)

Registers a timer that ends up in callback being called some specified time in the future.

Parameters
timeout_msThe expiry time in milliseconds from the current time
callbackThe callback that gets called at expiry time
callback_dataThe data that will be passed to callback
Returns
A pointer to an AppTimer that can be used to later reschedule or cancel this timer

◆ app_timer_reschedule()

bool app_timer_reschedule ( AppTimer *  timer_handle,
uint32_t  new_timeout_ms 
)

Reschedules an already running timer for some point in the future.

Parameters
timer_handleThe timer to reschedule
new_timeout_msThe new expiry time in milliseconds from the current time
Returns
true if the timer was rescheduled, false if the timer has already elapsed

◆ psleep()

void psleep ( int  millis)

Waits for a certain amount of milliseconds

Parameters
millisThe number of milliseconds to wait for