MetaWear C++ API  0.18.0
C++ implementation of the MetaWear protocol
Functions
timer.h File Reference

On board timer for scheduling MetaWear commands. More...

#include <stdint.h>
#include "metawearboard_fwd.h"
#include "timer_fwd.h"
#include "metawear/platform/dllmarker.h"

Go to the source code of this file.

Functions

METAWEAR_API void mbl_mw_timer_create (MblMwMetaWearBoard *board, uint32_t period, uint16_t repetitions, uint8_t delay, void *context, MblMwFnTimerPtr received_timer)
 Creates a timer that will run for a set number of repetitions. More...
 
METAWEAR_API void mbl_mw_timer_create_indefinite (MblMwMetaWearBoard *board, uint32_t period, uint8_t delay, void *context, MblMwFnTimerPtr received_timer)
 Creates a timer that will run indefinitely. More...
 
METAWEAR_API uint8_t mbl_mw_timer_get_id (const MblMwTimer *timer)
 Retrieves the id value identifying the timer. More...
 
METAWEAR_API MblMwTimermbl_mw_timer_lookup_id (const MblMwMetaWearBoard *board, uint8_t id)
 Looks up the MblMwTimer object corresponding to the id. More...
 
METAWEAR_API void mbl_mw_timer_start (const MblMwTimer *timer)
 Starts a timer. More...
 
METAWEAR_API void mbl_mw_timer_stop (const MblMwTimer *timer)
 Stops a timer. More...
 
METAWEAR_API void mbl_mw_timer_remove (MblMwTimer *timer)
 Removes the timer from the board. More...
 

Detailed Description

On board timer for scheduling MetaWear commands.

Function Documentation

◆ mbl_mw_timer_create()

METAWEAR_API void mbl_mw_timer_create ( MblMwMetaWearBoard board,
uint32_t  period,
uint16_t  repetitions,
uint8_t  delay,
void *  context,
MblMwFnTimerPtr  received_timer 
)

Creates a timer that will run for a set number of repetitions.

A pointer representing the timer will be passed to the user through a callback function

Parameters
boardBoard the timer belongs to
periodHow often to
repetitionsNumber of events the timer will fire
delayZero if the tiemr should immediately fire, non-zero to delay the first event
contextPointer to additional data for the callback function
received_timerCallback function to be executed when the timer is created

◆ mbl_mw_timer_create_indefinite()

METAWEAR_API void mbl_mw_timer_create_indefinite ( MblMwMetaWearBoard board,
uint32_t  period,
uint8_t  delay,
void *  context,
MblMwFnTimerPtr  received_timer 
)

Creates a timer that will run indefinitely.

A pointer representing the timer will be passed to the user through a callback function

Parameters
boardBoard the timer belongs to
periodHow often to
delayZero if the tiemr should immediately fire, non-zero to delay the first event
contextPointer to additional data for the callback function
received_timerCallback function to be executed when the timer is created

◆ mbl_mw_timer_get_id()

METAWEAR_API uint8_t mbl_mw_timer_get_id ( const MblMwTimer timer)

Retrieves the id value identifying the timer.

Parameters
timerTimer to lookup
Returns
Numerical id of the timer

◆ mbl_mw_timer_lookup_id()

METAWEAR_API MblMwTimer* mbl_mw_timer_lookup_id ( const MblMwMetaWearBoard board,
uint8_t  id 
)

Looks up the MblMwTimer object corresponding to the id.

Parameters
boardBoard to search on
idNumerical id to lookup
Returns
Timer object identified by the id, null if no object is found

◆ mbl_mw_timer_remove()

METAWEAR_API void mbl_mw_timer_remove ( MblMwTimer timer)

Removes the timer from the board.

Parameters
timerTimer to remove

◆ mbl_mw_timer_start()

METAWEAR_API void mbl_mw_timer_start ( const MblMwTimer timer)

Starts a timer.

Parameters
timerTimer to start

◆ mbl_mw_timer_stop()

METAWEAR_API void mbl_mw_timer_stop ( const MblMwTimer timer)

Stops a timer.

Parameters
timerTimer to stop