Robot Control Library
|
C interface for the Linux IIO ADC driver.
<rc/adc.h>
The Robotics cape and BeagleBone Blue include two voltage dividers for safe measurement of the 2-cell lithium battery voltage and the voltage of any power source connected to the 9-18V DC power jack. These can be read with c_adc_batt() and rc_adc_dc_jack()
There is also a 6-pin JST-SH socket on the Cape for connecting up to 4 potentiometers or general use analog signals. The pinout of this socket is as follows:
All 8 ADC channels on the Sitara including the 4 listed above can be read with rc_adc_read_raw(int ch) which returns the raw integer output of the 12-bit ADC. rc_adc_read_volt(int ch) additionally converts this raw value to a voltage.
See the rc_test_adc example for sample use case.
Functions | |
int | rc_adc_init (void) |
initializes the analog to digital converter for reading More... | |
int | rc_adc_cleanup (void) |
Cleans up the ADC subsystem. More... | |
int | rc_adc_read_raw (int ch) |
reads the raw integer ADC value for a particular channel More... | |
double | rc_adc_read_volt (int ch) |
reads an adc voltage. More... | |
double | rc_adc_batt (void) |
reads the voltage of the 2-cell Lithium battery More... | |
double | rc_adc_dc_jack (void) |
Reads the voltage of the 9-18v DC jack. More... | |
int rc_adc_init | ( | void | ) |
initializes the analog to digital converter for reading
int rc_adc_cleanup | ( | void | ) |
Cleans up the ADC subsystem.
Call before your program closes down
int rc_adc_read_raw | ( | int | ch | ) |
reads the raw integer ADC value for a particular channel
[in] | ch | channel 0-7 |
double rc_adc_read_volt | ( | int | ch | ) |
reads an adc voltage.
[in] | ch | channel 0-7 |
double rc_adc_batt | ( | void | ) |
reads the voltage of the 2-cell Lithium battery
double rc_adc_dc_jack | ( | void | ) |
Reads the voltage of the 9-18v DC jack.