mecha10-core 0.8.2

Mecha10 core runtime and foundational types
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! 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;

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));
    }
}