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

i2c: switch all i2c drivers definitions to use i2c bus interface type #193

Merged
merged 1 commit into from
Aug 29, 2020

Conversation

deadprogram
Copy link
Member

This PR switches all i2c drivers definitions to use i2c bus interface type instead of machine package concrete type.

Once it is merged into dev, then individual drivers can have tests added as time permits.

… instead of machine package concrete type

Signed-off-by: deadprogram <[email protected]>
@deadprogram
Copy link
Member Author

I am working in branch https://github.com/tinygo-org/drivers/tree/adt7410-tests-improvements on improvements to the ADT7410 based on this branch.

@aykevl
Copy link
Member

aykevl commented Aug 27, 2020

I checked code size differences using make smoke-test and there are indeed some differences. Often in the 20-100 byte range, but sometimes larger. The largest I've seen was somewhere in the 500 byte range (although there is also a decrease).

I think this is worth the cost, especially considering the testability improvements and increased flexibility. Interfaces will allow the use of software I2C for any driver, which may come in use when you don't get to choose pins or existing I2C pins cannot be used.

@deadprogram
Copy link
Member Author

Thanks for the review, now merging.

@deadprogram deadprogram merged commit db02cbb into dev Aug 29, 2020
@deadprogram deadprogram deleted the i2c-interface branch August 29, 2020 15:19
@conejoninja
Copy link
Member

Now that this has been merged, should we do something similar with SPI? That would be helpful with issue #151 were a driver implements both I²C and SPI, but the board only implements one of those and fails to compile.

@deadprogram
Copy link
Member Author

Yes, that is for sure the next step.

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