Driver to use an ADC on a supported serial device. More...
#include <adc_driver.h>
Public Member Functions | |
AdcDriver (bosch_hardware_interface *hw, uint8_t adc_pin) | |
sets up one pin as an ADC pin with the default reference voltage | |
uint8_t | getDeviceAddress (void) |
bool | initialize () |
Initializes the driver and the connected hardware. | |
uint32_t | read () |
Reads the analog voltage from the connected hardware device. | |
bool | setReference (uint32_t voltage) |
Sets the reference voltage on the hardware for all analog pins. | |
~AdcDriver () | |
Private Attributes | |
uint8_t | _pin |
Driver to use an ADC on a supported serial device.
This class lets the user access the ADC pins of any supported hardware
Definition at line 55 of file adc_driver.h.
AdcDriver::AdcDriver | ( | bosch_hardware_interface * | hw, |
uint8_t | adc_pin | ||
) |
sets up one pin as an ADC pin with the default reference voltage
Constructor:
hw | Connected hardware interface |
adc_pin | Pin to use on the connected hardware |
Definition at line 41 of file adc_driver.cpp.
Definition at line 46 of file adc_driver.cpp.
uint8_t AdcDriver::getDeviceAddress | ( | void | ) | [virtual] |
Implements bosch_drivers_common::sensor_driver.
Definition at line 50 of file adc_driver.cpp.
bool AdcDriver::initialize | ( | ) |
Initializes the driver and the connected hardware.
Definition at line 56 of file adc_driver.cpp.
uint32_t AdcDriver::read | ( | ) |
Reads the analog voltage from the connected hardware device.
Definition at line 67 of file adc_driver.cpp.
bool AdcDriver::setReference | ( | uint32_t | voltage | ) |
Sets the reference voltage on the hardware for all analog pins.
voltage | The voltage to set the reference to in mV. Check the hardware interface implementation for supported voltages. Setting this parameter to 0 will set the reference type to external |
Definition at line 94 of file adc_driver.cpp.
uint8_t AdcDriver::_pin [private] |
Definition at line 95 of file adc_driver.h.