flipperzero-rs / flipperzero

Rust on the Flipper Zero
MIT License
521 stars 35 forks source link

flipperzero: I2C interface #111

Closed str4d closed 1 year ago

str4d commented 1 year ago

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

str4d commented 1 year ago

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.

str4d commented 1 year ago

Force-pushed to use Duration instead of u32.

str4d commented 1 year ago

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

str4d commented 1 year ago

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.