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

Non blocking #26

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Non blocking #26

wants to merge 3 commits into from

Conversation

JeffyW
Copy link

@JeffyW JeffyW commented Aug 5, 2016

This change addresses issue #24.

This adds a pattern for asking for changes in a polling fashion, removing the delays.
It includes a working example of how it can be used.

Note that this also depends upon changes #22 and #25.

As per issue adafruit#14, Wire.requestFrom does not need to call
Wire.endTransmission.
This change converts most methods to return their status (rather than
void).
In this change, the isDataReady method is introduced as a way to poll on
whether data is ready to be ready or not.  On its first invocation, it
requests that temperature be read and records the timestamp.  On future
invocations, it checks whether enough time has passed, and if so, will
read the data.  Upon reading temperature data, it requests pressure data
and vice versa.  When being run in this mode, calling getTemperature or
getPressure will read the previously stored value (and perform any
appropriate calculations on the data).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants