Skip to content

Commit

Permalink
refactor(embassy-common): move crate re-exports to a dedicated module
Browse files Browse the repository at this point in the history
  • Loading branch information
ROMemories committed Sep 20, 2024
1 parent 84d9987 commit b0f8b0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/riot-rs-embassy-common/src/i2c/controller/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl From<NoAcknowledgeSource> for embedded_hal::i2c::NoAcknowledgeSource {
#[macro_export]
macro_rules! impl_async_i2c_for_driver_enum {
($driver_enum:ident, $( $peripheral:ident ),*) => {
impl embedded_hal_async::i2c::I2c for $driver_enum {
impl $crate::reexports::embedded_hal_async::i2c::I2c for $driver_enum {
async fn read(&mut self, address: u8, read: &mut [u8]) -> Result<(), Self::Error> {
match self {
$(
Expand Down Expand Up @@ -173,7 +173,7 @@ macro_rules! handle_i2c_timeout_res {
($i2c:ident, $op:ident, $address:ident, $( $param:ident ),+) => {{
let res = $crate::embassy_futures::select::select(
// Disambiguate between the trait methods and the direct methods.
$crate::embedded_hal_async::i2c::I2c::$op(&mut $i2c.twim, $address, $( $param ),+),
$crate::reexports::embedded_hal_async::i2c::I2c::$op(&mut $i2c.twim, $address, $( $param ),+),
$crate::embassy_time::Timer::after($crate::i2c::controller::I2C_TIMEOUT),
).await;

Expand Down
6 changes: 5 additions & 1 deletion src/riot-rs-embassy-common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@ pub mod i2c;
pub use embassy_futures;
pub use embassy_time;

pub use embedded_hal_async;
pub mod reexports {
//! Crate re-exports.

pub use embedded_hal_async;
}

0 comments on commit b0f8b0c

Please sign in to comment.