initial
This commit is contained in:
62
ads1210.h
Normal file
62
ads1210.h
Normal file
@ -0,0 +1,62 @@
|
||||
#ifndef _ads1210_h_
|
||||
#define _ads1210_h_
|
||||
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class ADS1210 {
|
||||
public:
|
||||
ADS1210(uint8_t csPin);
|
||||
void begin() const;
|
||||
uint32_t get();
|
||||
private:
|
||||
// register addresses
|
||||
const uint8_t ADDR_DOR2 = 0x00;
|
||||
const uint8_t ADDR_DOR1 = 0x01;
|
||||
const uint8_t ADDR_DOR0 = 0x02;
|
||||
|
||||
const uint8_t ADDR_CMR3 = 0x04;
|
||||
const uint8_t ADDR_CMR2 = 0x05;
|
||||
const uint8_t ADDR_CMR1 = 0x06;
|
||||
const uint8_t ADDR_CMR0 = 0x07;
|
||||
|
||||
const uint8_t ADDR_OCR2 = 0x08;
|
||||
const uint8_t ADDR_OCR1 = 0x09;
|
||||
const uint8_t ADDR_OCR0 = 0x0a;
|
||||
|
||||
const uint8_t ADDR_FCR2 = 0x0c;
|
||||
const uint8_t ADDR_FCR1 = 0x0d;
|
||||
const uint8_t ADDR_FCR0 = 0x0e;
|
||||
|
||||
// bit values
|
||||
// CMR
|
||||
const uint8_t CMR_BIAS = 0x80;
|
||||
const uint8_t CMR_REFO = 0x40;
|
||||
const uint8_t CMR_DF = 0x20;
|
||||
const uint8_t CMR_UB = 0x10;
|
||||
const uint8_t CMR_BD = 0x08;
|
||||
const uint8_t CMR_MSB = 0x04;
|
||||
const uint8_t CMR_SDL = 0x02;
|
||||
const uint8_t CMR_DRDY = 0x01;
|
||||
|
||||
// bit values
|
||||
// INSR
|
||||
const uint8_t INSR_RW = 0x80;
|
||||
const uint8_t INSR_MB1 = 0x40;
|
||||
const uint8_t INSR_MB0 = 0x20;
|
||||
const uint8_t INSR_ADDR = 0x0f;
|
||||
|
||||
uint8_t m_csPin;
|
||||
|
||||
void enableCS() const;
|
||||
void disableCS() const;
|
||||
void writeCMR (const uint8_t cmr3, const uint8_t cmr2,
|
||||
const uint8_t cmr1, const uint8_t cmr0) const;
|
||||
};
|
||||
|
||||
|
||||
#endif // _ads1210_h_
|
Reference in New Issue
Block a user