Public Member Functions | Private Attributes
AdcDriver Class Reference

Driver to use an ADC on a supported serial device. More...

#include <adc_driver.h>

Inheritance diagram for AdcDriver:
Inheritance graph
[legend]

List of all members.

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

Detailed Description

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.


Constructor & Destructor Documentation

AdcDriver::AdcDriver ( bosch_hardware_interface hw,
uint8_t  adc_pin 
)

sets up one pin as an ADC pin with the default reference voltage

Constructor:

Parameters:
hwConnected hardware interface
adc_pinPin to use on the connected hardware
Note:
the ADC reference voltage will be set to the default value of the connected serial device (usually the supply voltage)

Definition at line 41 of file adc_driver.cpp.

Definition at line 46 of file adc_driver.cpp.


Member Function Documentation

uint8_t AdcDriver::getDeviceAddress ( void  ) [virtual]

Implements bosch_drivers_common::sensor_driver.

Definition at line 50 of file adc_driver.cpp.

Initializes the driver and the connected hardware.

Returns:
a boolean indicating success

Definition at line 56 of file adc_driver.cpp.

uint32_t AdcDriver::read ( )

Reads the analog voltage from the connected hardware device.

Returns:
The read voltage in micro volts [µV]

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.

Parameters:
voltageThe 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
Returns:
true if the reference was applied successfully
Todo:
think about switching to µV?

Definition at line 94 of file adc_driver.cpp.


Member Data Documentation

uint8_t AdcDriver::_pin [private]

Definition at line 95 of file adc_driver.h.


The documentation for this class was generated from the following files:


adc_driver
Author(s): Kai Franke
autogenerated on Sat Dec 28 2013 16:49:47