ardupilot/libraries/AP_AnalogSource/AP_AnalogSource_ADC.cpp
Pat Hickey 0c0a1b1dcc purple: Added AnalogSource library
this library abstracts out the way of getting an analog value. If the
ADC library is being used then it calls the ADC Ch() method, otherwise
it calls analogRead()
2011-11-25 20:00:16 -08:00

10 lines
169 B
C++

#include "AP_AnalogSource_ADC.h"
int AP_AnalogSource_ADC::read(void)
{
int fullscale = _adc->Ch(_ch);
int scaled = _prescale * fullscale;
return scaled;
}