stm32/gpio: expose all functionality as inherent methods.
This commit is contained in:
@ -8,7 +8,6 @@ use embassy::executor::Spawner;
|
||||
use embassy::time::{Duration, Timer};
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_stm32::Peripherals;
|
||||
use embedded_hal::digital::v2::OutputPin;
|
||||
use example_common::*;
|
||||
|
||||
#[embassy::main]
|
||||
@ -19,11 +18,11 @@ async fn main(_spawner: Spawner, p: Peripherals) {
|
||||
|
||||
loop {
|
||||
info!("high");
|
||||
unwrap!(led.set_high());
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
|
||||
info!("low");
|
||||
unwrap!(led.set_low());
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,6 @@
|
||||
#[path = "../example_common.rs"]
|
||||
mod example_common;
|
||||
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
|
||||
use embedded_hal::digital::v2::{InputPin, OutputPin};
|
||||
use example_common::*;
|
||||
|
||||
use cortex_m_rt::entry;
|
||||
@ -21,12 +20,12 @@ fn main() -> ! {
|
||||
let mut led2 = Output::new(p.PB9, Level::High, Speed::Low);
|
||||
|
||||
loop {
|
||||
if button.is_high().unwrap() {
|
||||
led1.set_high().unwrap();
|
||||
led2.set_low().unwrap();
|
||||
if button.is_high() {
|
||||
led1.set_high();
|
||||
led2.set_low();
|
||||
} else {
|
||||
led1.set_low().unwrap();
|
||||
led2.set_high().unwrap();
|
||||
led1.set_low();
|
||||
led2.set_high();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
|
||||
use embassy_stm32::interrupt;
|
||||
use embassy_stm32::subghz::*;
|
||||
use embassy_stm32::Peripherals;
|
||||
use embedded_hal::digital::v2::OutputPin;
|
||||
use example_common::unwrap;
|
||||
|
||||
const PING_DATA: &str = "PING";
|
||||
@ -89,9 +88,9 @@ async fn main(_spawner: embassy::executor::Spawner, p: Peripherals) {
|
||||
|
||||
defmt::info!("Radio ready for use");
|
||||
|
||||
unwrap!(led1.set_low());
|
||||
led1.set_low();
|
||||
|
||||
unwrap!(led2.set_high());
|
||||
led2.set_high();
|
||||
|
||||
unwrap!(radio.set_standby(StandbyClk::Rc));
|
||||
unwrap!(radio.set_tcxo_mode(&TCXO_MODE));
|
||||
@ -110,11 +109,11 @@ async fn main(_spawner: embassy::executor::Spawner, p: Peripherals) {
|
||||
|
||||
defmt::info!("Status: {:?}", unwrap!(radio.status()));
|
||||
|
||||
unwrap!(led2.set_low());
|
||||
led2.set_low();
|
||||
|
||||
loop {
|
||||
pin.wait_for_rising_edge().await;
|
||||
unwrap!(led3.set_high());
|
||||
led3.set_high();
|
||||
unwrap!(radio.set_irq_cfg(&CfgIrq::new().irq_enable_all(Irq::TxDone)));
|
||||
unwrap!(radio.write_buffer(TX_BUF_OFFSET, PING_DATA_BYTES));
|
||||
unwrap!(radio.set_tx(Timeout::DISABLED));
|
||||
@ -127,6 +126,6 @@ async fn main(_spawner: embassy::executor::Spawner, p: Peripherals) {
|
||||
defmt::info!("TX done");
|
||||
}
|
||||
unwrap!(radio.clear_irq_status(irq_status));
|
||||
unwrap!(led3.set_low());
|
||||
led3.set_low();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user