-
Notifications
You must be signed in to change notification settings - Fork 1
Add writeByte. Add support for I2C restarts #25
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
Conversation
Add writeByte for both I2C and SPI - needed by the ADS1219 on I2C Add support for I2C restart vs. stop (many devices require a restart between set-register-address and read-register-value). This is I2C-specific and may be needed on non-Arduino platforms too. Added setStop and getStop. Corrected readRegisterRegion: the beginTransmission and endTransmission should be inside the if(bFirstInter).
TODO: I propose changing:
to:
and return the number of bytes read in |
Yeah, I missed that in my quick revision last week - and typedef equivalence kept the compiler from complaining. |
@@ -34,7 +34,7 @@ class sfeTkII2C : public sfeTkIBus | |||
sfeTkII2C() : _address{kNoAddress} | |||
{ | |||
} | |||
sfeTkII2C(uint8_t addr) : _address{addr} | |||
sfeTkII2C(uint8_t addr) : _address{addr}, _stop{true} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd move the initialization of _stop{true} to the default ctor - the constructor without arguments(the method above this one).
And since _stop is a uint8_t, should the default value be 1? I would specify the number, not the value of true
in the initializer).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yes. 1 is the correct choice. The Arduino source uses a mixture of uint8_t but with bool terminology. Let's stick with 1.
If you have time to jump on this, please go for it! Otherwise, I'm very happy to pick this up in the morning. Long story short, the ToolKit is working very nicely in the ADS1219 library! |
Great to hear it's working !! Thanks for updates/additions. I'll merge it and tweak the constructor ... and the Arduino version so it get's picked up by the Arduino lib bot |
I'll take a crack at this in my other branch so that I can incorporate that into my UV library too. |
....I have this written and about to do a PR with some tweaks to the stop message API... |
writeByte
for both I2C and SPI - needed by the ADS1219 on I2CsetStop
andgetStop
readRegisterRegion
beginTransmission
andendTransmission
should be inside theif (bFirstInter)