ruuvi.drivers.c  ${PROJECT_VERSION}
Drivers for external sensors and peripherals on embedded systems.
Interface for timing tasks to be exeuted later.

Files

file  ruuvi_interface_scheduler_test.h
 Test interface functions to scheduler.
 
file  ruuvi_interface_timer.h
 Interface functions to timer.
 

Typedefs

typedef void * ri_timer_id_t
 Pointer to timer data. More...
 
typedef void(* ruuvi_timer_timeout_handler_t) (void *const p_context)
 Function to be called when timer times out. More...
 

Enumerations

enum  ri_timer_mode_t { RI_TIMER_MODE_SINGLE_SHOT , RI_TIMER_MODE_REPEATED }
 Enable implementation selected by application. More...
 

Functions

bool ri_timer_integration_test_run (const rd_test_print_fp printfp)
 Run all timer integration tests. More...
 
rd_status_t ri_timer_init (void)
 
rd_status_t ri_timer_uninit (void)
 
bool ri_timer_is_init (void)
 Check if timer is initialized. More...
 
rd_status_t ri_timer_create (ri_timer_id_t *p_timer_id, ri_timer_mode_t mode, ruuvi_timer_timeout_handler_t timeout_handler)
 
rd_status_t ri_timer_start (ri_timer_id_t timer_id, uint32_t ms, void *const context)
 Start given timer at a mode defined in ri_timer_create. More...
 
rd_status_t ri_timer_stop (ri_timer_id_t timer_id)
 

Detailed Description

Typedef Documentation

◆ ri_timer_id_t

typedef void* ri_timer_id_t

Pointer to timer data.

Definition at line 79 of file ruuvi_interface_timer.h.

◆ ruuvi_timer_timeout_handler_t

typedef void(* ruuvi_timer_timeout_handler_t) (void *const p_context)

Function to be called when timer times out.

Parameters
p_contextpointer to context to be passed to handler, can be NULL.

Definition at line 86 of file ruuvi_interface_timer.h.

Enumeration Type Documentation

◆ ri_timer_mode_t

Enable implementation selected by application.

Single or continuous execution of task.

Enumerator
RI_TIMER_MODE_SINGLE_SHOT 
RI_TIMER_MODE_REPEATED 

Definition at line 73 of file ruuvi_interface_timer.h.

Function Documentation

◆ ri_timer_create()

rd_status_t ri_timer_create ( ri_timer_id_t p_timer_id,
ri_timer_mode_t  mode,
ruuvi_timer_timeout_handler_t  timeout_handler 
)

◆ ri_timer_init()

rd_status_t ri_timer_init ( void  )

◆ ri_timer_integration_test_run()

bool ri_timer_integration_test_run ( const rd_test_print_fp  printfp)

Run all timer integration tests.

Parameters
[in]printfpFunction to which test JSON is passed.
Return values
falseif no errors occured.
trueif error occured.

◆ ri_timer_is_init()

bool ri_timer_is_init ( void  )

Check if timer is initialized.

Return values
trueif timers have been successfully initialized.
falseif timer is not initialized.

◆ ri_timer_start()

rd_status_t ri_timer_start ( ri_timer_id_t  timer_id,
uint32_t  ms,
void *const  context 
)

Start given timer at a mode defined in ri_timer_create.

This operation is ignored if timer is already running.

Parameters
[in]timer_idid of timer to control
[in]mstimeout (or interval) of timer in milliseconds.
[in]contextPointer passed to timer handler.

Return RD_SUCCESS on success, error code on start.

◆ ri_timer_stop()

rd_status_t ri_timer_stop ( ri_timer_id_t  timer_id)

Stop a running timer.

Parameters
timer_idid of timer to stop returns RD_SUCCESS on success, error code from stack on error

◆ ri_timer_uninit()

rd_status_t ri_timer_uninit ( void  )