2010-11-27 00:41:25 -04:00
|
|
|
#ifndef AP_ADC_ADS7844_H
|
|
|
|
#define AP_ADC_ADS7844_H
|
|
|
|
|
|
|
|
#define bit_set(p,m) ((p) |= ( 1<<m))
|
|
|
|
#define bit_clear(p,m) ((p) &= ~(1<<m))
|
|
|
|
|
|
|
|
// We use Serial Port 2 in SPI Mode
|
|
|
|
#define ADC_DATAOUT 51 // MOSI
|
|
|
|
#define ADC_DATAIN 50 // MISO
|
|
|
|
#define ADC_SPICLOCK 52 // SCK
|
|
|
|
#define ADC_CHIP_SELECT 33 // PC4 9 // PH6 Puerto:0x08 Bit mask : 0x40
|
2011-09-12 16:57:36 -03:00
|
|
|
#define ADC_FILTER_SIZE 3
|
2010-11-27 00:41:25 -04:00
|
|
|
|
|
|
|
#include "AP_ADC.h"
|
2011-06-12 20:50:15 -03:00
|
|
|
#include <inttypes.h>
|
2010-11-27 00:41:25 -04:00
|
|
|
|
|
|
|
class AP_ADC_ADS7844 : public AP_ADC
|
|
|
|
{
|
2011-06-12 20:50:15 -03:00
|
|
|
public:
|
2010-11-27 00:41:25 -04:00
|
|
|
AP_ADC_ADS7844(); // Constructor
|
2011-06-12 20:50:15 -03:00
|
|
|
void Init();
|
2011-09-15 00:01:45 -03:00
|
|
|
|
|
|
|
// Read 1 sensor value
|
|
|
|
uint16_t Ch(unsigned char ch_num);
|
|
|
|
|
|
|
|
// Read 6 sensors at once
|
2011-09-15 05:45:51 -03:00
|
|
|
uint32_t Ch6(const uint8_t *channel_numbers, uint16_t *result);
|
|
|
|
|
|
|
|
private:
|
|
|
|
};
|
2010-11-27 00:41:25 -04:00
|
|
|
|
|
|
|
#endif
|