XBee Firmware Library  1.6.0
Functions
High Resolution Timer

Functions

int timer_config (timer_t timer, bool_t enable, timermode_t mode, uint32_t timeout)
 Function that configures the settings of the timer component. More...
 
void timer_enable (timer_t timer, uint8_t enable)
 Function that enables/disables the timer module. More...
 
timermode_t timer_get_mode (timer_t timer)
 Function that returns timer's mode configuration. More...
 
uint32_t timer_get_timeout (timer_t timer)
 Function that returns the timeout of the timer interrupt if it is configured as One-Shot timer or the period if it is configured as a periodic timer. More...
 
int timer_irq_enable (timer_t timer, bool_t enable)
 Function that enables timer interrupt. More...
 
int timer_set_mode (timer_t timer, timermode_t mode)
 Function that sets timer's mode. More...
 
int timer_set_timeout (timer_t timer, uint32_t timeout)
 Function that sets the timeout of the timer interrupt if it is configured as One-Shot timer or the period if it is configured as a periodic timer. More...
 

Detailed Description

Timer API Overview

This API contains the functions to configure and control the High
Resolution Timer component on programmable XBee devices.

- Timer interrupt request functions:
    - timer_config()
    - timer_set_timeout()
    - timer_get_timeout()
    - timer_set_mode()
    - timer_get_mode()
    - timer_irq_enable()
    - timer_enable()

Timer API Configuration Macros

The timer_config function needs a parameter to state the timer type. The two different options are defined in the following macros:

Function Documentation

int timer_config ( timer_t  timer,
bool_t  enable,
timermode_t  mode,
uint32_t  timeout 
)

Function that configures the settings of the timer component.

Parameters
[in]timertimer to configure (use the name of the component defined by the config.xml)
[in]enableTRUE for enabling, FALSE for disabling the timer.
[in]modedesired mode for the timer (use defined macros).
[in]timeoutdesired time for the timer to timeout
Return values
0On success.
-EINVALIf timer is not a valid timer.
-EOVERFLOWIf u_secs is not in supported ranges.
void timer_enable ( timer_t  timer,
uint8_t  enable 
)

Function that enables/disables the timer module.

Parameters
[in]timertimer to enable IRQ (use the name of the component defined by config.xml).
[in]enableTRUE for enabling, FALSE for disabling module.
Return values
nothing
timermode_t timer_get_mode ( timer_t  timer)

Function that returns timer's mode configuration.

Parameters
[in]timertimer to get mode (use the name of the component defined by config.xml).
Return values
timermode_tTimer mode: ONE_SHOT or PERIODIC. This determines how many times the interrupt will be entered. NO_VALID if bad timer is passed as argument.
uint32_t timer_get_timeout ( timer_t  timer)

Function that returns the timeout of the timer interrupt if it is configured as One-Shot timer or the period if it is configured as a periodic timer.

Parameters
[in]timertimer to get timeout (use the name of the component defined by config.xml).
Return values
uint32_tconfigured timeout (in microseconds).
int timer_irq_enable ( timer_t  timer,
bool_t  enable 
)

Function that enables timer interrupt.

Parameters
[in]timertimer to enable IRQ (use the name of the component defined by config.xml).
[in]enableTRUE to enable, FALSE to disable IRQ.
Return values
0on success.
-EINVALIf timer is not a valid timer.
int timer_set_mode ( timer_t  timer,
timermode_t  mode 
)

Function that sets timer's mode.

Parameters
[in]timertimer to set mode (use the name of the component defined by the config.xml).
[in]modeTimer mode: ONE_SHOT or PERIODIC. This determines how many times the interrupt will be entered.
Return values
-EINVALIf timer is not a valid timer.
-ERANGEout of range.
int timer_set_timeout ( timer_t  timer,
uint32_t  timeout 
)

Function that sets the timeout of the timer interrupt if it is configured as One-Shot timer or the period if it is configured as a periodic timer.

Parameters
[in]timertimer to set timeout (use the name of the component defined by config.xml).
[in]u_secsTimeout of interrupt in microseconds.
Return values
0On success.
-EINVALIf timer is not a valid timer.
-EOVERFLOWIf u_secs is not in supported ranges.