2016-02-17 21:25:12 -04:00
|
|
|
#pragma once
|
2011-09-18 00:49:00 -03:00
|
|
|
|
2015-08-11 03:28:41 -03:00
|
|
|
#include <AP_Common/AP_Common.h>
|
2013-08-29 02:34:34 -03:00
|
|
|
/*
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2011-09-15 00:01:45 -03:00
|
|
|
|
2011-09-18 00:49:00 -03:00
|
|
|
/*
|
2012-08-17 02:39:22 -03:00
|
|
|
* AP_ADC.cpp - Analog Digital Converter Base Class for Ardupilot Mega
|
|
|
|
* Code by James Goppert. DIYDrones.com
|
|
|
|
*
|
|
|
|
* Methods:
|
|
|
|
* Init() : Initialization of ADC. (interrupts etc)
|
|
|
|
* Ch(ch_num) : Return the ADC channel value
|
|
|
|
* Ch6(channel_numbers, result) : Return 6 ADC channel values
|
|
|
|
*/
|
2011-09-18 00:49:00 -03:00
|
|
|
|
|
|
|
class AP_ADC
|
|
|
|
{
|
2012-08-17 02:39:22 -03:00
|
|
|
public:
|
|
|
|
AP_ADC() {
|
|
|
|
}; // Constructor
|
2012-10-09 19:39:43 -03:00
|
|
|
virtual void Init() = 0;
|
2012-08-17 02:39:22 -03:00
|
|
|
|
|
|
|
/* read one channel value */
|
|
|
|
virtual float Ch(uint8_t ch_num) = 0;
|
|
|
|
|
|
|
|
/* read 6 channels values as a set, used by IMU for 3 gyros
|
|
|
|
* and 3 accelerometeres.
|
|
|
|
*
|
|
|
|
* Pass in an array of 6 channel numbers and results are
|
|
|
|
* returned in result[]
|
|
|
|
*
|
|
|
|
* The function returns the amount of time (in microseconds)
|
|
|
|
* since the last call to Ch6().
|
|
|
|
*/
|
|
|
|
virtual uint32_t Ch6(const uint8_t *channel_numbers, float *result) = 0;
|
|
|
|
|
|
|
|
// check if Ch6() can return new data
|
|
|
|
virtual bool new_data_available(const uint8_t *channel_numbers) = 0;
|
|
|
|
|
2012-08-30 04:50:03 -03:00
|
|
|
virtual uint16_t num_samples_available(const uint8_t *channel_numbers) = 0;
|
|
|
|
|
2012-08-17 02:39:22 -03:00
|
|
|
private:
|
2011-09-15 00:01:45 -03:00
|
|
|
};
|
|
|
|
|
2011-09-18 00:49:00 -03:00
|
|
|
#include "AP_ADC_ADS7844.h"
|
2014-11-26 08:01:29 -04:00
|
|
|
#include "AP_ADC_ADS1115.h"
|