Add support for reading single continous from ISR - #26
Open
drLaba wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi! First, thank you very much for the library. And for the documentation provided!
I used the library in a project with data read from several sensors, including one ADS1256. The sensors took some time to read, and thus with high sampling rates, ADS1256 didn't get the chance (time) to read its value before it was overwritten (by the next high-frequency ADS1256 measurement).
In general — reading values from ADS1256 in an interrupt, and buffering them (storing temporarily), allows to use the library alongside other, slower to execute, code.
The approach was succinctly explained by dr Bonet over on Arduino Stack Exchange.
This pull request uses interrupts differently than the way they have been used previously in the library (54c63e5).
It does not impact the existing
read___()andcycle___()methods*.Here, data from ADS1256 is read in the interrupt.
To achieve it, I've added:
readSingleContinuous()—readSingleContinuousImmediately().This method does not wait for the desired state (LOW/HIGH) of DRDY signal.
I've considered also
readSingleContinuousFromISR()to align with ESP32's FreeRTOS naming convention, but decided it may imply too much.setInterruptFunction().I've decided to include it in the library, because the PIN number of
DRDYand signal indicating ready data (FALLING) are both known to the library, and constant.startSingleContinousConversion()method, to be used: manually when using this new interrupt-based approach, and called from withinreadSingleContinuous()instead of the code being inline.readSingleContinuous()stays backwards compatible.I tried to keep the library's coding style and conventions.
I believe the implementation is specific to each project, so I didn't add an example code use case.