Skip to content

Commit

Permalink
Merge pull request #27 from generationmake/non_blocking
Browse files Browse the repository at this point in the history
add a non blocking function to set compare channel
  • Loading branch information
wollewald committed Oct 16, 2023
2 parents 4dedad7 + e1655bd commit 20afc13
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ setMeasureMode KEYWORD2
setVoltageRange_mV KEYWORD2
setAutoRange KEYWORD2
setCompareChannels KEYWORD2
setCompareChannels_nonblock KEYWORD2
isBusy KEYWORD2
startSingleMeasurement KEYWORD2
getResult_V KEYWORD2
Expand Down Expand Up @@ -93,4 +94,4 @@ ADS1115_COMP_1_GND LITERAL1
ADS1115_COMP_2_GND LITERAL1
ADS1115_COMP_3_GND LITERAL1
ADS1115_BUSY LITERAL1
ADS1115_START_ISREADY LITERAL1
ADS1115_START_ISREADY LITERAL1
7 changes: 7 additions & 0 deletions src/ADS1115_WE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,13 @@ void ADS1115_WE::setCompareChannels(ADS1115_MUX mux){
}
}

void ADS1115_WE::setCompareChannels_nonblock(ADS1115_MUX mux){
uint16_t currentConfReg = readRegister(ADS1115_CONFIG_REG);
currentConfReg &= ~(0xF000);
currentConfReg |= (mux);
writeRegister(ADS1115_CONFIG_REG, currentConfReg);
}

void ADS1115_WE::setSingleChannel(size_t channel) {
if (channel >= 4)
return;
Expand Down
4 changes: 4 additions & 0 deletions src/ADS1115_WE.h
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,10 @@ class ADS1115_WE
*/
void setCompareChannels(ADS1115_MUX mux);

/* Set to channel (0-3) in single ended mode in a non blocking way without delay
*/
void setCompareChannels_nonblock(ADS1115_MUX mux);

/* Set to channel (0-3) in single ended mode
*/
void setSingleChannel(size_t channel);
Expand Down

0 comments on commit 20afc13

Please sign in to comment.