2011-12-16 04:30:46 -04:00
|
|
|
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
2012-10-09 19:39:43 -03:00
|
|
|
#ifndef __AP_ADC_ADS7844_H__
|
|
|
|
#define __AP_ADC_ADS7844_H__
|
2011-12-16 04:30:46 -04:00
|
|
|
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
2012-10-09 19:39:43 -03:00
|
|
|
#include "AP_ADC.h"
|
2015-08-11 03:28:41 -03:00
|
|
|
#include <AP_HAL/AP_HAL.h>
|
2011-12-16 04:30:46 -04:00
|
|
|
|
|
|
|
class AP_ADC_ADS7844 : public AP_ADC
|
|
|
|
{
|
2012-08-17 02:39:21 -03:00
|
|
|
public:
|
|
|
|
AP_ADC_ADS7844(); // Constructor
|
2012-10-09 19:39:43 -03:00
|
|
|
void Init();
|
2011-12-16 04:30:46 -04:00
|
|
|
|
2012-08-17 02:39:21 -03:00
|
|
|
// Read 1 sensor value
|
|
|
|
float Ch(unsigned char ch_num);
|
2011-12-16 04:30:46 -04:00
|
|
|
|
2012-08-17 02:39:21 -03:00
|
|
|
// Read 6 sensors at once
|
|
|
|
uint32_t Ch6(const uint8_t *channel_numbers, float *result);
|
2012-03-03 03:31:09 -04:00
|
|
|
|
|
|
|
// check if Ch6 would block
|
2012-08-17 02:39:21 -03:00
|
|
|
bool new_data_available(const uint8_t *channel_numbers);
|
2012-03-03 03:31:09 -04:00
|
|
|
|
2012-08-30 04:50:03 -03:00
|
|
|
// Get minimum number of samples read from the sensors
|
|
|
|
uint16_t num_samples_available(const uint8_t *channel_numbers);
|
|
|
|
|
2012-08-17 02:39:21 -03:00
|
|
|
private:
|
2013-09-28 03:30:16 -03:00
|
|
|
void read(void);
|
|
|
|
AP_HAL::SPIDeviceDriver *_spi;
|
|
|
|
AP_HAL::Semaphore *_spi_sem;
|
2011-12-16 04:30:46 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|