Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added command to reset the device via the register #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions src/ADS131M0x.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,37 @@ int32_t ADS131M0x::readfastCh0(void)
return val32Ch0;
}

/// @brief reset device from register, read CAP 8.5.1.10 Commands from official documentation
/// @param
/// @return True if the device responded with the RSP_RESET_OK message
bool ADS131M0x::resetDevice(void){
uint8_t x = 0;
uint8_t x2 = 0;
uint16_t ris = 0;

digitalWrite(csPin, LOW);
#ifndef NO_CS_DELAY
delayMicroseconds(1);
#endif

x = spiPort->transfer(0x00);
x2 = spiPort->transfer(0x11);
spiPort->transfer(0x00);

ris = ((x << 8) | x2);

digitalWrite(csPin, HIGH);
#ifndef NO_CS_DELAY
delayMicroseconds(1);
#endif

if(RSP_RESET_OK == ris){
return true;
}
return false;
}


/// @brief Read ADC port (all Ports)
/// @param
/// @return
Expand Down
1 change: 1 addition & 0 deletions src/ADS131M0x.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@ class ADS131M0x
bool setChannelOffsetCalibration(uint8_t channel, int32_t offset);
bool setChannelGainCalibration(uint8_t channel, uint32_t gain);
bool setOsr(uint16_t osr);
bool resetDevice(void);

uint16_t isResetOK(void);
adcOutput readADC(void);
Expand Down