nRF5 SDK v16.0.0
Data Structures | Macros | Typedefs | Enumerations | Functions
Trickle Timer

Trickle timer module interface definition. More...

Data Structures

struct  trickle_params_t
 Structure holds Trickle timer instance parameters. More...
 

Macros

#define TRICKLE_TIMER_TX_SUPPRESSION_OFF   0
 

Typedefs

typedef void(* trickle_evt_handler_t )(uint32_t instance_id, trickle_evt_t event_type, uint32_t tx_evt_count)
 Callback function for notifying a Trickle timer instance of an event. More...
 

Enumerations

enum  trickle_evt_t {
  TRICKLE_EVT_DO_TX = 1,
  TRICKLE_EVT_TX_SKIPPED = 2,
  TRICKLE_EVT_IMAX_REACHED = 3,
  TRICKLE_EVT_DESTROYED = 4
}
 Trickle event types. More...
 
enum  trickle_t_min_choice_t {
  TRICKLE_T_MIN_ZERO = 1,
  TRICKLE_T_MIN_HALF_I = 2
}
 Valid choices for t_min when creating a new Trickle instance. More...
 

Functions

uint32_t trickle_init (uint8_t rnd_seed)
 Function for initializing the Trickle timer module. More...
 
uint32_t trickle_instance_create (trickle_params_t *p_timer_params, uint32_t *p_instance_id)
 Function for creating a Trickle timer instance. More...
 
uint32_t trickle_rx_consistent_register (uint32_t instance_id)
 Function for registering a "consistent" reception with the timer instance. More...
 
uint32_t trickle_instance_reset (uint32_t instance_id)
 Function for resetting the timer instance. More...
 
uint32_t trickle_instance_destroy (uint32_t instance_id)
 Function for destroying a timer instance and freeing the memory. More...
 
uint32_t trickle_terminate (void)
 Function for terminating the Trickle timer. More...
 

Detailed Description

Trickle timer module interface definition.

The Trickle timer implements the trickle algorithm as specified in RFC 6202. The module has a dependency on the Application timer module, only a single application timer instance is used. The value of the APP_TIMER_PRESCALER determines the accuracy of the Application timer and hence, the Trickle timer's accuracy as well. A lower APP_TIMER_PRESCALER value will increase accuracy and allow shorter timeouts. You can configure the module by changing the sdk_config.h configuration file.

Macro Definition Documentation

#define TRICKLE_TIMER_TX_SUPPRESSION_OFF   0

Value reserved for the redundancy constant to turn off transmission suppression.

Typedef Documentation

typedef void(* trickle_evt_handler_t)(uint32_t instance_id, trickle_evt_t event_type, uint32_t tx_evt_count)

Callback function for notifying a Trickle timer instance of an event.

Parameters
[in]instance_idIdentifies the timer client instance from which the event originates from.
[in]event_typeType of the event.
[in]tx_evt_countIndicates how many times the instance generated a TRICKLE_EVT_DO_TX event.
Return values
None.

Enumeration Type Documentation

Trickle event types.

Enumerator
TRICKLE_EVT_DO_TX 

Notifies the owner of the instance that it should transmit.

TRICKLE_EVT_TX_SKIPPED 

Generated at time t, if (c<k) was True before, but now it is False.

TRICKLE_EVT_IMAX_REACHED 

The current interval size (I) has reached the maximum interval size (i_max).

TRICKLE_EVT_DESTROYED 

The timer instance was destroyed.

Valid choices for t_min when creating a new Trickle instance.

Enumerator
TRICKLE_T_MIN_ZERO 

The transmission time t will be in the range of [0, I).

TRICKLE_T_MIN_HALF_I 

The transmission time t will be in the range of [(i/2), I).

Function Documentation

uint32_t trickle_init ( uint8_t  rnd_seed)

Function for initializing the Trickle timer module.

Parameters
[in]rnd_seedSeed for the calculation a pseudo-random value for the interval and transmission times.
Return values
NRF_ERROR_NO_MEMIf TRICKLE_MAX_INSTANCES is equal to zero.
NRF_ERROR_INVALID_STATEIf the module is already initialized.
NRF_SUCCESSOn successful execution of procedure, else an error code indicating reason for failure.
uint32_t trickle_instance_create ( trickle_params_t p_timer_params,
uint32_t *  p_instance_id 
)

Function for creating a Trickle timer instance.

Sets new Trickle timer instance parameters and starts the timer.

Parameters
[in]p_timer_paramsInitialization structure for the timer instance. Should not be NULL.
[out]p_instance_idIdentifier of the new Trickle timer instance.
Return values
NRF_SUCCESSOn successful execution of procedure, else an error code indicating reason for failure.
uint32_t trickle_instance_destroy ( uint32_t  instance_id)

Function for destroying a timer instance and freeing the memory.

Parameters
[in]instance_idIdentifier of the Trickle timer instance.
Return values
NRF_SUCCESSOn successful execution of procedure, else an error code indicating reason for failure.
uint32_t trickle_instance_reset ( uint32_t  instance_id)

Function for resetting the timer instance.

Parameters
[in]instance_idIdentifier of the Trickle timer instance.
Return values
NRF_SUCCESSOn successful execution of procedure, else an error code indicating reason for failure.
uint32_t trickle_rx_consistent_register ( uint32_t  instance_id)

Function for registering a "consistent" reception with the timer instance.

Parameters
[in]instance_idIdentifier of the Trickle timer instance.
Return values
NRF_SUCCESSOn successful execution of procedure, else an error code indicating reason for failure.
uint32_t trickle_terminate ( void  )

Function for terminating the Trickle timer.

Stops timer (releases any resources), notifies and destroys all existing instances and stops.

Return values
NRF_SUCCESSOn successful execution of procedure, else an error code indicating reason for failure.

Documentation feedback | Developer Zone | Subscribe | Updated