-
Notifications
You must be signed in to change notification settings - Fork 1
Add writeWord writeBlock #34
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
… to a given register * Still needs test
* Updates descriptions to indicate that these functions to not index to a given register.
Haven't reviewed, but in testing the Ultrasonic Arduino lib, I get the following warning:
I strongly recommend setting "Compiler warnings" in Arduino to "All" so these warnings show up |
I've been using the arduino-cli and didn't even think to increase verbosity! I will do that! |
@@ -87,14 +87,32 @@ class sfeTkIBus | |||
{ | |||
public: | |||
/**-------------------------------------------------------------------------- | |||
* @brief Write a single byte to the device* | |||
* @brief Send a single byte to the device* |
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.
Since all the methods use a "write*" naming pattern, shouldn't this be Write?
FWIW: Normally send/receive are used with network based operations - at least in my experience ....
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.
You're completely right. I was trying to get at the fact that it doesn't physically write bits/bytes to a register and so "send" seemed to fit. However, you're write (a joke there). I'll adjust to this: "Write a single byte, without indexing to a register". Something to that effect. I also have a few more things that I want to add to this pull request.
I added a few more methods for reading from a device without a register parameter. This compliments the previously added write methods. I have enabled warnings to makes sure I didn't miss those, and I've also adjusted the language around the description of the new and existing methods in the pull request. Many apologies for the disjointed manner of this pull request. |
Can I get another look at this? There's a library that is dependent on these functions going live this week. Thanks! |
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.
Summary:
- Unclear why the read*() methods were added - they are the same as readRegister*() in the arduino impl
- Added a method to implement writeBlock/Region() and reuse some code
- Was the SPI implementation provided for the added methods to the bus interface?
- And verify these make sense for an SPI device - if not, then these methods should not be in the core interface. - Has your changes been tested using the test action in the repo (or just compile the test sketch locally with different platforms)?
Happy to review this with you tomorrow.
* Changes the name of `writeBlock()` to `writeRegion()` * `writeRegion()` now calls `writeRegisterRegionAddress()` function * `writeRegisterRegionAddress()` now has a nullptr check before indexing to an address on write
*Adds `writeWord()` and `writeRegion()`
Issues addressed, may I get another look @gigapod? Thank you! |
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.
Everything looks good - based on the comments and code from yesterday.
On thing to note - Make sure this is tested with device drivers that are already using the toolkit ... it should, but this is a good regression test.
This adds two new functions that target the same functionality as
writeByte()
:writeWord()
andwriteBlock()
. The intent is to be able to send data over I2C without indexing to a register. This is helpful in the case where the device simply expects I2C commands over I2C. Examples of this include products like the new Ultrasonic Distance Sensor, Quad Relay, Qwiic Twist, Qwiic RFID, etc. Basically devices, at least in the examples I listed, that have micro-controllers that act as peripherals.