Add F7 example
This commit is contained in:
parent
f08f4df180
commit
224071f08e
@ -483,7 +483,9 @@ fn main() {
|
|||||||
(("i2c", "TX"), quote!(crate::i2c::TxDma)),
|
(("i2c", "TX"), quote!(crate::i2c::TxDma)),
|
||||||
(("dcmi", "DCMI"), quote!(crate::dcmi::FrameDma)),
|
(("dcmi", "DCMI"), quote!(crate::dcmi::FrameDma)),
|
||||||
(("dcmi", "PSSI"), quote!(crate::dcmi::FrameDma)),
|
(("dcmi", "PSSI"), quote!(crate::dcmi::FrameDma)),
|
||||||
(("sdmmc", "SDIO"), quote!(crate::sdmmc::SdmmcDma)),
|
// Same channel is used for RX/TX
|
||||||
|
(("sdmmc", "RX"), quote!(crate::sdmmc::SdmmcDma)),
|
||||||
|
(("sdmmc", "RX"), quote!(crate::sdmmc::SdmmcDma)),
|
||||||
]
|
]
|
||||||
.into();
|
.into();
|
||||||
|
|
||||||
|
43
examples/stm32f7/src/bin/sdmmc.rs
Normal file
43
examples/stm32f7/src/bin/sdmmc.rs
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
#![feature(type_alias_impl_trait)]
|
||||||
|
|
||||||
|
#[path = "../example_common.rs"]
|
||||||
|
mod example_common;
|
||||||
|
|
||||||
|
use embassy::executor::Spawner;
|
||||||
|
use embassy_stm32::sdmmc::Sdmmc;
|
||||||
|
use embassy_stm32::time::U32Ext;
|
||||||
|
use embassy_stm32::{interrupt, Config, Peripherals};
|
||||||
|
use example_common::*;
|
||||||
|
|
||||||
|
fn config() -> Config {
|
||||||
|
let mut config = Config::default();
|
||||||
|
config.rcc.sys_ck = Some(200.mhz().into());
|
||||||
|
config
|
||||||
|
}
|
||||||
|
|
||||||
|
#[embassy::main(config = "config()")]
|
||||||
|
async fn main(_spawner: Spawner, p: Peripherals) -> ! {
|
||||||
|
info!("Hello World!");
|
||||||
|
|
||||||
|
let irq = interrupt::take!(SDMMC1);
|
||||||
|
|
||||||
|
let mut sdmmc = Sdmmc::new(
|
||||||
|
p.SDMMC1,
|
||||||
|
(p.PC12, p.PD2, p.PC8, p.PC9, p.PC10, p.PC11),
|
||||||
|
irq,
|
||||||
|
Default::default(),
|
||||||
|
p.DMA2_CH3
|
||||||
|
);
|
||||||
|
|
||||||
|
info!("Configured clock: {}", sdmmc.clock.0);
|
||||||
|
|
||||||
|
unwrap!(sdmmc.init_card(25.mhz()).await);
|
||||||
|
|
||||||
|
let card = unwrap!(sdmmc.card());
|
||||||
|
|
||||||
|
info!("Card: {:#?}", Debug2Format(card));
|
||||||
|
|
||||||
|
loop {}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user