Cleanup
This commit is contained in:
parent
224071f08e
commit
9d71acc49e
@ -85,6 +85,7 @@ pub struct Card {
|
|||||||
/// SD Status
|
/// SD Status
|
||||||
pub status: SDStatus,
|
pub status: SDStatus,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Card {
|
impl Card {
|
||||||
/// Size in bytes
|
/// Size in bytes
|
||||||
pub fn size(&self) -> u64 {
|
pub fn size(&self) -> u64 {
|
||||||
@ -184,7 +185,7 @@ pub struct Sdmmc<'d, T: Instance, P: Pins<T>, Dma = NoDma> {
|
|||||||
config: Config,
|
config: Config,
|
||||||
dma: Dma,
|
dma: Dma,
|
||||||
/// Current clock to card
|
/// Current clock to card
|
||||||
pub clock: Hertz,
|
clock: Hertz,
|
||||||
/// Current signalling scheme to card
|
/// Current signalling scheme to card
|
||||||
signalling: Signalling,
|
signalling: Signalling,
|
||||||
/// Card
|
/// Card
|
||||||
@ -337,6 +338,11 @@ impl<'d, T: Instance, P: Pins<T>, Dma: SdmmcDma<T>> Sdmmc<'d, T, P, Dma> {
|
|||||||
self.card.as_ref().ok_or(Error::NoCard)
|
self.card.as_ref().ok_or(Error::NoCard)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Get the current SDMMC bus clock
|
||||||
|
pub fn clock(&self) -> Hertz {
|
||||||
|
self.clock
|
||||||
|
}
|
||||||
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn on_interrupt(_: *mut ()) {
|
fn on_interrupt(_: *mut ()) {
|
||||||
let regs = T::inner();
|
let regs = T::inner();
|
||||||
@ -666,11 +672,6 @@ impl SdmmcInner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Get the current SDMMC bus clock
|
|
||||||
//pub fn clock(&self) -> Hertz {
|
|
||||||
// self.clock
|
|
||||||
//}
|
|
||||||
|
|
||||||
/// Data transfer is in progress
|
/// Data transfer is in progress
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
fn data_active(&self) -> bool {
|
fn data_active(&self) -> bool {
|
||||||
@ -806,6 +807,7 @@ impl SdmmcInner {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Stops the DMA datapath
|
||||||
fn stop_datapath(&self) {
|
fn stop_datapath(&self) {
|
||||||
let regs = self.0;
|
let regs = self.0;
|
||||||
|
|
||||||
@ -1203,11 +1205,10 @@ impl SdmmcInner {
|
|||||||
w.set_cmdindex(12);
|
w.set_cmdindex(12);
|
||||||
w.set_cpsmen(true);
|
w.set_cpsmen(true);
|
||||||
|
|
||||||
cfg_if::cfg_if! {
|
#[cfg(sdmmc_v2)]
|
||||||
if #[cfg(sdmmc_v2)] {
|
{
|
||||||
w.set_cmdstop(true);
|
w.set_cmdstop(true);
|
||||||
w.set_cmdtrans(false);
|
w.set_cmdtrans(false);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@ async fn main(_spawner: Spawner, p: Peripherals) -> ! {
|
|||||||
p.DMA2_CH3,
|
p.DMA2_CH3,
|
||||||
);
|
);
|
||||||
|
|
||||||
info!("Configured clock: {}", sdmmc.clock.0);
|
// Should print 400kHz for initialization
|
||||||
|
info!("Configured clock: {}", sdmmc.clock().0);
|
||||||
|
|
||||||
unwrap!(sdmmc.init_card(25.mhz()).await);
|
unwrap!(sdmmc.init_card(25.mhz()).await);
|
||||||
|
|
||||||
|
@ -31,7 +31,8 @@ async fn main(_spawner: Spawner, p: Peripherals) -> ! {
|
|||||||
p.DMA2_CH3
|
p.DMA2_CH3
|
||||||
);
|
);
|
||||||
|
|
||||||
info!("Configured clock: {}", sdmmc.clock.0);
|
// Should print 400kHz for initialization
|
||||||
|
info!("Configured clock: {}", sdmmc.clock().0);
|
||||||
|
|
||||||
unwrap!(sdmmc.init_card(25.mhz()).await);
|
unwrap!(sdmmc.init_card(25.mhz()).await);
|
||||||
|
|
||||||
|
@ -30,7 +30,8 @@ async fn main(_spawner: Spawner, p: Peripherals) -> ! {
|
|||||||
Default::default(),
|
Default::default(),
|
||||||
);
|
);
|
||||||
|
|
||||||
info!("Configured clock: {}", sdmmc.clock.0);
|
// Should print 400kHz for initialization
|
||||||
|
info!("Configured clock: {}", sdmmc.clock().0);
|
||||||
|
|
||||||
unwrap!(sdmmc.init_card(25.mhz()).await);
|
unwrap!(sdmmc.init_card(25.mhz()).await);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user