XBee Firmware Library
1.6.0
|
Functions | |
int | adc_ch_enable (xpin_t pin, bool_t enable) |
Enables or disables the ADC channel running in the specified XBee pin. More... | |
uint16_t | adc_ch_read (xpin_t pin) |
Reads the value of the ADC channel running in the specified XBee pin. More... | |
int | adc_config (uint8_t config) |
Configures the ADC interface settings (all the ADC channels will share the same settings.) More... | |
Platform-specific layer provides a consistent ADC API to upper layers of the driver.
This API contains the functions to configure and control the ADC channels of the programmable XBee modules.
The 12-bit analog to digital converter (ADC12) is a successive approximation ADC designer for operation within an integrated microcontroller system-on-chip.
@note The bandgap channel cannot be converted in low power run mode or low power wait mode - ADC configuration functions: - adc_config() - adc_ch_enable() - ADC functions to read values: - adc_ch_read()
Platform-specific layer provides a consistent MACROS API to upper layers of the driver.
The adc_config() function needs as parameter a byte containing the configuration masks for the ADC channels. These masks are defined with macros and they are the following:
- Macros to configure the \b optimization of the ADC channels: - \b ADC_CFG_OPTIMIZE_FOR_SPEED : Optimizes the ADC channels for speed. - \b ADC_CFG_OPTIMIZE_FOR_POWER : Optimizes the ADC channels for power saving. - Macros to select the \b mode of the ADC channels: - \b ADC_CFG_MODE_8BIT : Enables the 8-bits conversion. - \b ADC_CFG_MODE_10BIT : Enables the 10-bits conversion. - \b ADC_CFG_MODE_12BIT : Enables the 12-bits conversion. - Macros to enable the \b mode \b bit-mask: - \b ADC_CFG_MODE_BIT_MASK : Enables the bit mask mode.
Usage example:
Enables or disables the ADC channel running in the specified XBee pin.
[in] | pin | XBee pin configured as ADC channel. |
[in] | enable | 1 to enable the ADC channel, 0 to disable it. |
0 | on success |
ERANGE | out of range |
Reads the value of the ADC channel running in the specified XBee pin.
[in] | pin | XBee pin configured as ADC channel to read data from. |
uint16_t | the value read from the ADC channel. |
0xffff | if the XBee pin is not configured as ADC channel or there was a timeout error. |
int adc_config | ( | uint8_t | config | ) |
Configures the ADC interface settings (all the ADC channels will share the same settings.)
[in] | config | a byte containing the configuration masks for the ADC channels. See the ADC Macros for more information. |
0 | on success |