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

flipperzero: I2C interface #111

Merged
merged 1 commit into from
Oct 15, 2023
Merged

flipperzero: I2C interface #111

merged 1 commit into from
Oct 15, 2023

Conversation

str4d
Copy link
Contributor

@str4d str4d commented Oct 6, 2023

This adds a Rust API for using both the external and internal I2C bus with 7-bit addresses.

@str4d
Copy link
Contributor Author

str4d commented Oct 6, 2023

For now this just uses the helper interfaces that the Flipper Zero SDK provides for 7-bit addresses, but those are all themselves implemented in terms of the underlying 10-bit-capable raw interface which is also exposed. So if that's desired then we could re-implement the helper methods in Rust. However, furi_hal_i2c_is_device_ready is only exposed for 7-bit addresses.

Copy link
Collaborator

@dcoles dcoles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! Looks like I'll need to find me a DS3231 for testing.

crates/flipperzero/src/gpio/i2c.rs Show resolved Hide resolved
crates/flipperzero/src/gpio/i2c.rs Outdated Show resolved Hide resolved
@str4d
Copy link
Contributor Author

str4d commented Oct 7, 2023

Force-pushed to use Duration instead of u32.

@str4d
Copy link
Contributor Author

str4d commented Oct 7, 2023

Force-pushed to remove the convenience methods from i2c::Bus.

Copy link
Collaborator

@dcoles dcoles left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 👍

@str4d
Copy link
Contributor Author

str4d commented Oct 15, 2023

At some point in the future I'll experiment with 10-bit interface support, either once I have a 10-bit device to test with, or as part of adding embedded-hal support for #113. But this is fine to merge for now.

@str4d str4d merged commit 1fcf63d into main Oct 15, 2023
@str4d str4d deleted the i2c branch October 15, 2023 04:45
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.

2 participants