diff options
| author | Dario Nieuwenhuis <[email protected]> | 2024-01-22 20:44:57 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-01-22 20:44:57 +0000 |
| commit | c1ba008be457cdc8fe083fe36e380aa60dd784e2 (patch) | |
| tree | caabf0c20ce7d2d07e292690b1afb9baa606610f /docs | |
| parent | 20fd03a14f1261e7b2264dcbca8e164393e66b94 (diff) | |
| parent | ee0ebe3121e5d51240e671d8c5cc19ad878b9db9 (diff) | |
Merge pull request #2471 from embassy-rs/remove-gpio-generics
gpio: remove generics.
Diffstat (limited to 'docs')
3 files changed, 9 insertions, 11 deletions
diff --git a/docs/modules/ROOT/examples/basic/src/main.rs b/docs/modules/ROOT/examples/basic/src/main.rs index 2a4ee5968..4412712c8 100644 --- a/docs/modules/ROOT/examples/basic/src/main.rs +++ b/docs/modules/ROOT/examples/basic/src/main.rs | |||
| @@ -4,12 +4,11 @@ | |||
| 4 | use defmt::*; | 4 | use defmt::*; |
| 5 | use embassy_executor::Spawner; | 5 | use embassy_executor::Spawner; |
| 6 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; | 6 | use embassy_nrf::gpio::{Level, Output, OutputDrive}; |
| 7 | use embassy_nrf::peripherals::P0_13; | ||
| 8 | use embassy_time::{Duration, Timer}; | 7 | use embassy_time::{Duration, Timer}; |
| 9 | use {defmt_rtt as _, panic_probe as _}; // global logger | 8 | use {defmt_rtt as _, panic_probe as _}; // global logger |
| 10 | 9 | ||
| 11 | #[embassy_executor::task] | 10 | #[embassy_executor::task] |
| 12 | async fn blinker(mut led: Output<'static, P0_13>, interval: Duration) { | 11 | async fn blinker(mut led: Output<'static>, interval: Duration) { |
| 13 | loop { | 12 | loop { |
| 14 | led.set_high(); | 13 | led.set_high(); |
| 15 | Timer::after(interval).await; | 14 | Timer::after(interval).await; |
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs index e6753be28..004602816 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs +++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-async/src/main.rs | |||
| @@ -3,14 +3,14 @@ | |||
| 3 | 3 | ||
| 4 | use embassy_executor::Spawner; | 4 | use embassy_executor::Spawner; |
| 5 | use embassy_stm32::exti::ExtiInput; | 5 | use embassy_stm32::exti::ExtiInput; |
| 6 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; | 6 | use embassy_stm32::gpio::{Level, Output, Pull, Speed}; |
| 7 | use {defmt_rtt as _, panic_probe as _}; | 7 | use {defmt_rtt as _, panic_probe as _}; |
| 8 | 8 | ||
| 9 | #[embassy_executor::main] | 9 | #[embassy_executor::main] |
| 10 | async fn main(_spawner: Spawner) { | 10 | async fn main(_spawner: Spawner) { |
| 11 | let p = embassy_stm32::init(Default::default()); | 11 | let p = embassy_stm32::init(Default::default()); |
| 12 | let mut led = Output::new(p.PB14, Level::Low, Speed::VeryHigh); | 12 | let mut led = Output::new(p.PB14, Level::Low, Speed::VeryHigh); |
| 13 | let mut button = ExtiInput::new(Input::new(p.PC13, Pull::Up), p.EXTI13); | 13 | let mut button = ExtiInput::new(p.PC13, p.EXTI13, Pull::Up); |
| 14 | 14 | ||
| 15 | loop { | 15 | loop { |
| 16 | button.wait_for_any_edge().await; | 16 | button.wait_for_any_edge().await; |
diff --git a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs b/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs index aecba0755..743c9d99b 100644 --- a/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs +++ b/docs/modules/ROOT/examples/layer-by-layer/blinky-irq/src/main.rs | |||
| @@ -6,13 +6,12 @@ use core::cell::RefCell; | |||
| 6 | use cortex_m::interrupt::Mutex; | 6 | use cortex_m::interrupt::Mutex; |
| 7 | use cortex_m::peripheral::NVIC; | 7 | use cortex_m::peripheral::NVIC; |
| 8 | use cortex_m_rt::entry; | 8 | use cortex_m_rt::entry; |
| 9 | use embassy_stm32::gpio::{Input, Level, Output, Pin, Pull, Speed}; | 9 | use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed}; |
| 10 | use embassy_stm32::peripherals::{PB14, PC13}; | ||
| 11 | use embassy_stm32::{interrupt, pac}; | 10 | use embassy_stm32::{interrupt, pac}; |
| 12 | use {defmt_rtt as _, panic_probe as _}; | 11 | use {defmt_rtt as _, panic_probe as _}; |
| 13 | 12 | ||
| 14 | static BUTTON: Mutex<RefCell<Option<Input<'static, PC13>>>> = Mutex::new(RefCell::new(None)); | 13 | static BUTTON: Mutex<RefCell<Option<Input<'static>>>> = Mutex::new(RefCell::new(None)); |
| 15 | static LED: Mutex<RefCell<Option<Output<'static, PB14>>>> = Mutex::new(RefCell::new(None)); | 14 | static LED: Mutex<RefCell<Option<Output<'static>>>> = Mutex::new(RefCell::new(None)); |
| 16 | 15 | ||
| 17 | #[entry] | 16 | #[entry] |
| 18 | fn main() -> ! { | 17 | fn main() -> ! { |
| @@ -62,14 +61,14 @@ fn EXTI15_10() { | |||
| 62 | 61 | ||
| 63 | const PORT: u8 = 2; | 62 | const PORT: u8 = 2; |
| 64 | const PIN: usize = 13; | 63 | const PIN: usize = 13; |
| 65 | fn check_interrupt<P: Pin>(_pin: &mut Input<'static, P>) -> bool { | 64 | fn check_interrupt(_pin: &mut Input<'static>) -> bool { |
| 66 | let exti = pac::EXTI; | 65 | let exti = pac::EXTI; |
| 67 | let pin = PIN; | 66 | let pin = PIN; |
| 68 | let lines = exti.pr(0).read(); | 67 | let lines = exti.pr(0).read(); |
| 69 | lines.line(pin) | 68 | lines.line(pin) |
| 70 | } | 69 | } |
| 71 | 70 | ||
| 72 | fn clear_interrupt<P: Pin>(_pin: &mut Input<'static, P>) { | 71 | fn clear_interrupt(_pin: &mut Input<'static>) { |
| 73 | let exti = pac::EXTI; | 72 | let exti = pac::EXTI; |
| 74 | let pin = PIN; | 73 | let pin = PIN; |
| 75 | let mut lines = exti.pr(0).read(); | 74 | let mut lines = exti.pr(0).read(); |
| @@ -77,7 +76,7 @@ fn clear_interrupt<P: Pin>(_pin: &mut Input<'static, P>) { | |||
| 77 | exti.pr(0).write_value(lines); | 76 | exti.pr(0).write_value(lines); |
| 78 | } | 77 | } |
| 79 | 78 | ||
| 80 | fn enable_interrupt<P: Pin>(_pin: &mut Input<'static, P>) { | 79 | fn enable_interrupt(_pin: &mut Input<'static>) { |
| 81 | cortex_m::interrupt::free(|_| { | 80 | cortex_m::interrupt::free(|_| { |
| 82 | let rcc = pac::RCC; | 81 | let rcc = pac::RCC; |
| 83 | rcc.apb2enr().modify(|w| w.set_syscfgen(true)); | 82 | rcc.apb2enr().modify(|w| w.set_syscfgen(true)); |
