Initial proof of concept

This commit is contained in:
Zachary Levy
2025-03-09 12:13:14 -07:00
commit e06e76e46b
55 changed files with 4508 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
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<DelayT: DelayNs> {
delayer: DelayT,
}
impl<DelayT: DelayNs> DefaultDelay<DelayT> {
#[inline(always)]
pub const fn new(delayer: DelayT) -> Self {
Self { delayer }
}
}
impl<DelayT: DelayNs> BlockingDelay for DefaultDelay<DelayT> {
#[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);
}
}