stm32/gpio: expose all functionality as inherent methods.

This commit is contained in:
Dario Nieuwenhuis
2022-01-14 22:02:00 +01:00
parent 52e156b429
commit 58fc64722c
34 changed files with 266 additions and 210 deletions

View File

@ -11,7 +11,6 @@ use embassy_stm32::spi::{Config, Spi};
use embassy_stm32::time::Hertz;
use embassy_stm32::Peripherals;
use embassy_traits::spi::FullDuplex;
use embedded_hal::digital::v2::{InputPin, OutputPin};
use example_common::*;
#[embassy::main]
@ -38,17 +37,17 @@ async fn main(_spawner: Spawner, p: Peripherals) {
let ready = Input::new(p.PE1, Pull::Up);
cortex_m::asm::delay(100_000);
unwrap!(reset.set_high());
reset.set_high();
cortex_m::asm::delay(100_000);
while unwrap!(ready.is_low()) {
while ready.is_low() {
info!("waiting for ready");
}
let write = [0x0A; 10];
let mut read = [0; 10];
unwrap!(cs.set_low());
cs.set_low();
spi.read_write(&mut read, &write).await.ok();
unwrap!(cs.set_high());
cs.set_high();
info!("xfer {=[u8]:x}", read);
}