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

Allow for overriding TwoWire class's internal functions #2245

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

Dan-Kouba
Copy link

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

  • 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)

@eberseth
Copy link
Contributor

Perhaps make the I2C interface protected in the class as well

protected:
  hal_i2c_interface_t _i2c;

cc @avtolstoy

@Dan-Kouba
Copy link
Author

@eberseth I'm good with that — would preclude the interface() function from being needed in derived classes. Shall I submit a new commit?

@eberseth
Copy link
Contributor

eberseth commented Dec 17, 2020

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants