Input Capture API Overview
This API contains the functions to configure and control the Output Compare component on programmable XBee devices.
- Output Compare functions:
Output Compare Configuration Macros
The ocompare_ch_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:
- OCOMPARE_TOGGLE: to toggle output at output-compare interrupt.
- OCOMPARE_CLEAR : to clear output at output-compare interrupt
- OCOMPARE_SET : to set output at output-compare interrupt
Function that configures the settings of the output-compare component.
- Parameters
-
[in] | pin | pin to be configured. |
[in] | enable | TRUE for enabling, FALSE for disabling the Output Compare IRQ on pin. |
[in] | max_timeout | Maximum timeout value (in microseconds) that will be used in the followings calls to ocompare_set_timeout function. |
[in] | init_timeout | timeout value (in microseconds) for the first interrupt. |
[in] | behavior | state of the pin when timeout is achieved: set, clear or toggle (use defined macros). |
- Return values
-
0 | on success |
-EINVAL | if the selected pin is not output-compare capable or bad parameters are passed. |
-EOVERFLOW | if the requested timeouts can't be achieved |
Function that enables/disables the output-compare 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 output-compare capable. |
int ocompare_get_mode |
( |
xpin_t |
pin | ) |
|
Function that returns the programmed behavior of the output-compare pin.
- Parameters
-
[in] | pin | Pin to read behavior. |
- Return values
-
int | The configured behavior (refer to defined macros). |
-EINVAL | If the selected pin is not output-compare capable. |
Function that returns the status of output-compare interrupt.
- Parameters
-
[in] | pin | pin (channel) to read status |
- Return values
-
int | the configured status. |
-EINVAL | if the selected pin is not output-compare capable. |
Function that sets behavior of the output-compare pin.
- Parameters
-
[in] | pin | pin to set behavior. |
- Return values
-
int | the configured behavior. |
-EINVAL | if the selected pin is not output-compare capable. |
Function that sets timeout of the output-compare interrupt.
- Parameters
-
[in] | pin | pin to set IRQ timeout |
- Return values
-
0 | on success |
-EINVAL | if the selected pin is not output-compare capable |