use embedded_hal::delay::DelayNs; //TODO: Change to maybe async when available instead of always blocking pub trait BlockingDelay { /// Delay between spi write and read in a read data command /// Total 50 master clock cycles fn t6_delay(&mut self); /// Delay after RREG, WREG, RDATA /// Total 4 master clock cycles fn t11_1_delay(&mut self); /// Delay after RDATAC, RESET, SYNC /// Total 24 master clock cycles fn t11_2_delay(&mut self); } pub struct DefaultDelay { delayer: DelayT, } impl DefaultDelay { #[inline(always)] pub const fn new(delayer: DelayT) -> Self { Self { delayer } } } impl BlockingDelay for DefaultDelay { #[inline(always)] fn t6_delay(&mut self) { self.delayer.delay_us(7); } #[inline(always)] fn t11_1_delay(&mut self) { self.delayer.delay_us(1); } #[inline(always)] fn t11_2_delay(&mut self) { self.delayer.delay_us(4); } }