seems to work now
This commit is contained in:
20
ads1210.cpp
20
ads1210.cpp
@ -22,7 +22,7 @@ void ADS1210::disableCS() const {
|
||||
}
|
||||
|
||||
void ADS1210::waitForDRdy() const {
|
||||
uint32_t timeOut = 100000;
|
||||
uint32_t timeOut = 1000000;
|
||||
while ((0 != digitalRead(m_drdyPin)) && timeOut) {
|
||||
timeOut--;
|
||||
}
|
||||
@ -69,10 +69,14 @@ void ADS1210::exec() {
|
||||
res.in[3] = 0;
|
||||
disableCS();
|
||||
|
||||
// Serial << "DOR4x8: " << _HEX(res.in[3]) << " " << _HEX(res.in[2]) << " " << _HEX(res.in[1]) << " " << _HEX(res.in[0]) << endl;
|
||||
// Serial << "DOR1x32: " << _HEX(res.out) << endl;
|
||||
//Serial << "DOR4x8: " << _HEX(res.in[3]) << " " << _HEX(res.in[2]) << " " << _HEX(res.in[1]) << " " << _HEX(res.in[0]) << endl;
|
||||
//Serial << "DOR1x32: " << _HEX(res.out) << endl;
|
||||
|
||||
value = res.out;
|
||||
|
||||
if (value == 0) {
|
||||
// fatal(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -103,7 +107,7 @@ void ADS1210::begin(uint8_t csPin, uint8_t drdyPin) {
|
||||
digitalWrite(m_csPin, HIGH);
|
||||
SPI.begin();
|
||||
SPI.setBitOrder(MSBFIRST);
|
||||
SPI.setClockDivider(SPI_CLOCK_DIV16);
|
||||
SPI.setClockDivider(SPI_CLOCK_DIV8);
|
||||
SPI.setDataMode(SPI_MODE1);
|
||||
Serial << "done." << endl;
|
||||
|
||||
@ -111,11 +115,13 @@ void ADS1210::begin(uint8_t csPin, uint8_t drdyPin) {
|
||||
Serial << "Start ADS1210 initialization ... ";
|
||||
pinMode(m_drdyPin, INPUT);
|
||||
writeRegister(ADDR_CMR3, CMR_SDL | CMR_UB | CMR_REFO);
|
||||
writeRegister(ADDR_CMR1, 0x1b); // data rate
|
||||
writeRegister(ADDR_CMR0, 0x58);
|
||||
Serial << "done." << endl;
|
||||
|
||||
Serial << "Set gain ... ";
|
||||
setGain(CMR_Gain_2);
|
||||
Serial << "done." << endl;
|
||||
// Serial << "Set gain ... ";
|
||||
// setGain(CMR_Gain_2);
|
||||
// Serial << "done." << endl;
|
||||
|
||||
Serial << "SelfCalibration ... ";
|
||||
setMode(CMR_MD_SelfCalibration);
|
||||
|
Reference in New Issue
Block a user