device-os
device-os copied to clipboard
Allow for overriding TwoWire class's internal functions
submission notes
**Important:** Please sanitize/remove any confidential info like usernames, passwords, org names, product names/ids, access tokens, client ids/secrets, or anything else you don't wish to share.
Please Read and Sign the Contributor License Agreement ([Info here](https://github.com/spark/firmware/blob/develop/CONTRIBUTING.md)).
You may also delete this submission notes header if you'd like. Thank you for contributing!
Problem
The current implementation of the TwoWire class does not define its methods as virtual
, therefore preventing any classes that inherit from TwoWire from overriding those functions.
Solution
This PR adds the virtual
identifier to most internal functions allowing for override when deriving from this class.
Completeness
- [x] User is totes amazing for contributing!
- [ ] Contributor has signed CLA (Info here)
- [ ] Problem and Solution clearly stated
- [ ] Run unit/integration/application tests on device
- [ ] Added documentation
- [ ] Added to CHANGELOG.md after merging (add links to docs and issues)
Perhaps make the I2C interface protected in the class as well
protected:
hal_i2c_interface_t _i2c;
cc @avtolstoy
@eberseth I'm good with that — would preclude the interface()
function from being needed in derived classes. Shall I submit a new commit?
@eberseth I'm good with that — would preclude the
interface()
function from being needed in derived classes. Shall I submit a new commit?
You can make changes, squash, and force push to overwrite the branch.