Improve the SPIv2 DMA example to verify it actually works.
This commit is contained in:
parent
0d2051243e
commit
bee7f60f08
@ -18,8 +18,8 @@ use example_common::*;
|
|||||||
use embassy_stm32::spi::{Spi, Config};
|
use embassy_stm32::spi::{Spi, Config};
|
||||||
use embassy_traits::spi::FullDuplex;
|
use embassy_traits::spi::FullDuplex;
|
||||||
use embassy_stm32::time::Hertz;
|
use embassy_stm32::time::Hertz;
|
||||||
use embassy_stm32::gpio::{Output, Level, Speed};
|
use embassy_stm32::gpio::{Output, Level, Speed, Input, Pull};
|
||||||
use embedded_hal::digital::v2::OutputPin;
|
use embedded_hal::digital::v2::{OutputPin, InputPin};
|
||||||
|
|
||||||
#[embassy::task]
|
#[embassy::task]
|
||||||
async fn main_task() {
|
async fn main_task() {
|
||||||
@ -36,9 +36,23 @@ async fn main_task() {
|
|||||||
Config::default(),
|
Config::default(),
|
||||||
);
|
);
|
||||||
|
|
||||||
let mut cs = Output::new(p.PE0, Level::High, Speed::VeryHigh);
|
|
||||||
|
|
||||||
loop {
|
// These are the pins for the Inventek eS-Wifi SPI Wifi Adapter.
|
||||||
|
|
||||||
|
let mut boot = Output::new(p.PB12, Level::Low, Speed::VeryHigh);
|
||||||
|
let mut wake = Output::new(p.PB13, Level::Low, Speed::VeryHigh);
|
||||||
|
let mut reset = Output::new(p.PE8, Level::Low, Speed::VeryHigh);
|
||||||
|
let mut cs = Output::new(p.PE0, Level::High, Speed::VeryHigh);
|
||||||
|
let mut ready = Input::new(p.PE1, Pull::Up);
|
||||||
|
|
||||||
|
cortex_m::asm::delay(100_000);
|
||||||
|
reset.set_high();
|
||||||
|
cortex_m::asm::delay(100_000);
|
||||||
|
|
||||||
|
while ready.is_low().unwrap() {
|
||||||
|
info!("waiting for ready");
|
||||||
|
}
|
||||||
|
|
||||||
let write = [0x0A; 10];
|
let write = [0x0A; 10];
|
||||||
let mut read = [0; 10];
|
let mut read = [0; 10];
|
||||||
unwrap!(cs.set_low());
|
unwrap!(cs.set_low());
|
||||||
@ -46,7 +60,6 @@ async fn main_task() {
|
|||||||
unwrap!(cs.set_high());
|
unwrap!(cs.set_high());
|
||||||
info!("xfer {=[u8]:x}", read);
|
info!("xfer {=[u8]:x}", read);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
struct ZeroClock;
|
struct ZeroClock;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user