partly works
This commit is contained in:
@ -13,16 +13,16 @@ void setup() {
|
|||||||
Serial.begin(9600);
|
Serial.begin(9600);
|
||||||
delay(1000);
|
delay(1000);
|
||||||
|
|
||||||
pinMode(13, OUTPUT);
|
pinMode(8, OUTPUT);
|
||||||
|
|
||||||
ads1210.begin(9, 8);
|
ads1210.begin(9, 7);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop() {
|
void loop() {
|
||||||
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
|
digitalWrite(8, HIGH); // turn the LED on (HIGH is the voltage level)
|
||||||
delay(1000); // wait for a second
|
delay(1000); // wait for a second
|
||||||
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
|
digitalWrite(8, LOW); // turn the LED off by making the voltage LOW
|
||||||
delay(1000); // wait for a second
|
delay(1000); // wait for a second
|
||||||
|
|
||||||
uint32_t adcValue = ads1210.get();
|
uint32_t adcValue = ads1210.get();
|
||||||
|
@ -25,7 +25,8 @@ void ADS1210::disableCS() const {
|
|||||||
|
|
||||||
void ADS1210::waitForDRdy() const {
|
void ADS1210::waitForDRdy() const {
|
||||||
uint32_t timeOut = 100000;
|
uint32_t timeOut = 100000;
|
||||||
while ((0 != digitalRead(m_drdyPin)) && timeOut--) {
|
while ((0 != digitalRead(m_drdyPin)) && timeOut) {
|
||||||
|
timeOut--;
|
||||||
}
|
}
|
||||||
if (0 == timeOut) {
|
if (0 == timeOut) {
|
||||||
fatal(1);
|
fatal(1);
|
||||||
@ -39,7 +40,7 @@ void ADS1210::waitForDRdyWOTimeout() const {
|
|||||||
|
|
||||||
|
|
||||||
void ADS1210::writeRegister(const uint8_t regAddr, const uint8_t value) const {
|
void ADS1210::writeRegister(const uint8_t regAddr, const uint8_t value) const {
|
||||||
waitForDRdy();
|
//waitForDRdy();
|
||||||
enableCS();
|
enableCS();
|
||||||
SPI.transfer(regAddr);
|
SPI.transfer(regAddr);
|
||||||
SPI.transfer(value);
|
SPI.transfer(value);
|
||||||
@ -50,7 +51,7 @@ void ADS1210::writeRegister(const uint8_t regAddr, const uint8_t value) const {
|
|||||||
uint8_t ADS1210::readRegister(const uint8_t regAddr) const {
|
uint8_t ADS1210::readRegister(const uint8_t regAddr) const {
|
||||||
uint8_t res;
|
uint8_t res;
|
||||||
|
|
||||||
waitForDRdy();
|
//waitForDRdy();
|
||||||
enableCS();
|
enableCS();
|
||||||
SPI.transfer(regAddr | INSR_RW);
|
SPI.transfer(regAddr | INSR_RW);
|
||||||
res = SPI.transfer(0);
|
res = SPI.transfer(0);
|
||||||
|
Reference in New Issue
Block a user