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:
- Input Capture active-edge macros:
- ICAPTURE_RISING : to set rising edges as active edges.
- ICAPTURE_FALLING : to set falling edges as active edges.
- ICAPTURE_BOTH : to set both falling and rising edges as active.
Function that computes the number of microseconds from value captured on an input-capture event.
- Parameters
-
[in] | pin | pin which captured value. This is necesary to determine prescaler and clock source. |
[in] | captcount | value captured by interrupt. |
- Return values
-
Function that configures the settings of the input-capture component.
- Parameters
-
[in] | pin | pin to be configured. |
[in] | edge | edge on which interrupt will be triggered (use defined macros). |
[in] | enable | TRUE for enabling, FALSE for disabling the input-capture IRQ on pin. |
[in] | max_u_secs | maximum 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. |
Function that enables/disables the input-capture module.
- Parameters
-
[in] | pin | Pin (channel) to enable/disable. |
[in] | enable | TRUE for enabling, FALSE for disabling module. |
- Return values
-
0 | On success. |
-EINVAL | If 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] | pin | Pin to read active edge. |
- Return values
-
int | The configured active edge. |
-EINVAL | If the selected pin is not input-capture capable. |
Function that enables/disables the input-capture interrupt.
- Parameters
-
[in] | pin | Pin (channel) to set interrupt. |
[in] | enable | TRUE for enabling, FALSE for disabling IRQ. |
- Return values
-
0 | On success. |
-EINVAL | If the selected pin is not input-capture capable. |
Function that sets the active edge of the input-capture pin.
- Parameters
-
[in] | pin | Pin to configure active edge. |
- Return values
-
0 | if success. |
-EINVAL | If the selected pin is not input-capture capable |