//! Shared `embedded-hal` 0.2 / 1.0 compatibility shims.
//!
//! Some sensor drivers (e.g. the `mpu6050` crate) are still pinned to `embedded-hal` 0.2.x
//! upstream, while `linux-embedded-hal` has moved on to `embedded-hal` 1.0. This module bridges
//! the gap so callers don't have to hand-roll the same shim in every crate that talks to such a
//! driver.
use embedded_hal_compat::eh1_0::delay::DelayNs;
use linux_embedded_hal::Delay;
/// Wraps `linux_embedded_hal::Delay` (embedded-hal 1.0) so it satisfies the
/// `embedded_hal::blocking::delay::DelayMs<u8>` bound that some embedded-hal-0.2-era driver
/// crates (e.g. `mpu6050`) still require. `embedded-hal-compat`'s `Reverse` wrapper only
/// implements `DelayMs<u16>`/`DelayMs<u32>`, not `u8`, so this thin newtype fills that gap.
pub struct DelayCompat(pub Delay);
impl embedded_hal_compat::eh0_2::blocking::delay::DelayMs<u8> for DelayCompat {
fn delay_ms(&mut self, ms: u8) {
self.0.delay_ms(u32::from(ms));
}
}