some more initialization code
This commit is contained in:
26
ads1210.h
26
ads1210.h
@ -10,8 +10,8 @@
|
||||
|
||||
class ADS1210 {
|
||||
public:
|
||||
ADS1210(uint8_t csPin);
|
||||
void begin() const;
|
||||
ADS1210();
|
||||
void begin(uint8_t csPin);
|
||||
uint32_t get();
|
||||
private:
|
||||
// register addresses
|
||||
@ -42,6 +42,22 @@ private:
|
||||
const uint8_t CMR_MSB = 0x04;
|
||||
const uint8_t CMR_SDL = 0x02;
|
||||
const uint8_t CMR_DRDY = 0x01;
|
||||
|
||||
const uint8_t CMR_MD_Mask = 0xe0;
|
||||
const uint8_t CMR_MD_NormalMode = 0x00;
|
||||
const uint8_t CMR_MD_SelfCalibration = 0x20;
|
||||
const uint8_t CMR_MD_SystemOffsetCalibration = 0x40;
|
||||
const uint8_t CMR_MD_SystemFullScaleCalibration = 0x60;
|
||||
const uint8_t CMR_MD_PseudoSystemCalibration = 0x80;
|
||||
const uint8_t CMD_MD_BackgroundCalibration = 0xa0;
|
||||
const uint8_t CMD_MD_Sleep = 0xc0;
|
||||
|
||||
const uint8_t CMR_Gain_Mask = (0x07 << 2);
|
||||
const uint8_t CMD_Gain_1 = 0;
|
||||
const uint8_t CMD_Gain_2 = (0x01 << 2);
|
||||
const uint8_t CMD_Gain_4 = (0x02 << 2);
|
||||
const uint8_t CMD_Gain_8 = (0x03 << 2);
|
||||
const uint8_t CMD_Gain_16 = (0x04 << 2);
|
||||
|
||||
// bit values
|
||||
// INSR
|
||||
@ -52,10 +68,12 @@ private:
|
||||
|
||||
uint8_t m_csPin;
|
||||
|
||||
uint8_t m_cmrShadow[4];
|
||||
|
||||
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;
|
||||
void writeCMR() const;
|
||||
void readCMR();
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user