XBee Firmware Library  1.6.0
Functions
Input Capture component

Functions

uint32_t icapture_captcount_to_usec (xpin_t pin, size_t captcount)
 Function that computes the number of microseconds from value captured on an input-capture event. More...
 
int icapture_config (xpin_t pin, uint8_t edge, bool_t enable, uint32_t max_u_secs)
 Function that configures the settings of the input-capture component. More...
 
int icapture_enable (xpin_t pin, uint8_t enable)
 Function that enables/disables the input-capture module. More...
 
int icapture_get_mode (xpin_t pin)
 Function that returns the programmed active edge of the input-capture pin. More...
 
int icapture_irq_enable (xpin_t pin, uint8_t enable)
 Function that enables/disables the input-capture interrupt. More...
 
int icapture_set_mode (xpin_t pin, uint8_t mode)
 Function that sets the active edge of the input-capture pin. More...
 

Detailed Description

Input Capture API Overview

This API contains the functions to configure and control the Input Capture component on programmable XBee devices.

Input Capture Configuration Macros

The icapture_config function needs a parameter to state the active edge. The three different options are defined in the following macros:

Function Documentation

uint32_t icapture_captcount_to_usec ( xpin_t  pin,
size_t  captcount 
)

Function that computes the number of microseconds from value captured on an input-capture event.

Parameters
[in]pinpin which captured value. This is necesary to determine prescaler and clock source.
[in]captcountvalue captured by interrupt.
Return values
numberof microseconds.
int icapture_config ( xpin_t  pin,
uint8_t  edge,
bool_t  enable,
uint32_t  max_u_secs 
)

Function that configures the settings of the input-capture component.

Parameters
[in]pinpin to be configured.
[in]edgeedge on which interrupt will be triggered (use defined macros).
[in]enableTRUE for enabling, FALSE for disabling the input-capture IRQ on pin.
[in]max_u_secsmaximum time in uSeconds for sampling. This is used for configuring the prescaler and clock source so module can have the maximum resolution that allows to reach the max count.
int icapture_enable ( xpin_t  pin,
uint8_t  enable 
)

Function that enables/disables the input-capture module.

Parameters
[in]pinPin (channel) to enable/disable.
[in]enableTRUE for enabling, FALSE for disabling module.
Return values
0On success.
-EINVALIf the selected pin is not input-capture capable.
int icapture_get_mode ( xpin_t  pin)

Function that returns the programmed active edge of the input-capture pin.

Parameters
[in]pinPin to read active edge.
Return values
intThe configured active edge.
-EINVALIf the selected pin is not input-capture capable.
int icapture_irq_enable ( xpin_t  pin,
uint8_t  enable 
)

Function that enables/disables the input-capture interrupt.

Parameters
[in]pinPin (channel) to set interrupt.
[in]enableTRUE for enabling, FALSE for disabling IRQ.
Return values
0On success.
-EINVALIf the selected pin is not input-capture capable.
int icapture_set_mode ( xpin_t  pin,
uint8_t  mode 
)

Function that sets the active edge of the input-capture pin.

Parameters
[in]pinPin to configure active edge.
Return values
0if success.
-EINVALIf the selected pin is not input-capture capable