Improve the SPIv2 DMA example to verify it actually works.
@@ -18,8 +18,8 @@ use example_common::*;
use embassy_stm32::spi::{Spi, Config};
use embassy_traits::spi::FullDuplex;
use embassy_stm32::time::Hertz;
-use embassy_stm32::gpio::{Output, Level, Speed};
-use embedded_hal::digital::v2::OutputPin;
+use embassy_stm32::gpio::{Output, Level, Speed, Input, Pull};
+use embedded_hal::digital::v2::{OutputPin, InputPin};
#[embassy::task]
async fn main_task() {
@@ -36,9 +36,23 @@ async fn main_task() {
Config::default(),
);
+
+ // 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");
+ }
- loop {
let write = [0x0A; 10];
let mut read = [0; 10];
unwrap!(cs.set_low());
@@ -46,7 +60,6 @@ async fn main_task() {
unwrap!(cs.set_high());
info!("xfer {=[u8]:x}", read);
}
-}
struct ZeroClock;
