From 2bc5e9523d4373002487614ecfef1e3f0858fd66 Mon Sep 17 00:00:00 2001 From: Dario Nieuwenhuis Date: Mon, 22 Jan 2024 21:19:18 +0100 Subject: nrf/gpio: remove generics. --- examples/nrf52840/src/bin/ethernet_enc28j60.rs | 12 ++---------- examples/nrf52840/src/bin/gpiote_port.rs | 12 ++++++------ examples/nrf52840/src/bin/usb_hid_keyboard.rs | 4 ++-- examples/nrf52840/src/bin/wifi_esp_hosted.rs | 12 ++++++------ 4 files changed, 16 insertions(+), 24 deletions(-) (limited to 'examples') diff --git a/examples/nrf52840/src/bin/ethernet_enc28j60.rs b/examples/nrf52840/src/bin/ethernet_enc28j60.rs index a8e64b38a..279f32edc 100644 --- a/examples/nrf52840/src/bin/ethernet_enc28j60.rs +++ b/examples/nrf52840/src/bin/ethernet_enc28j60.rs @@ -24,10 +24,7 @@ bind_interrupts!(struct Irqs { #[embassy_executor::task] async fn net_task( stack: &'static Stack< - Enc28j60< - ExclusiveDevice, Output<'static, peripherals::P0_15>, Delay>, - Output<'static, peripherals::P0_13>, - >, + Enc28j60, Output<'static>, Delay>, Output<'static>>, >, ) -> ! { stack.run().await @@ -71,12 +68,7 @@ async fn main(spawner: Spawner) { // Init network stack static RESOURCES: StaticCell> = StaticCell::new(); static STACK: StaticCell< - Stack< - Enc28j60< - ExclusiveDevice, Output<'static, peripherals::P0_15>, Delay>, - Output<'static, peripherals::P0_13>, - >, - >, + Stack, Output<'static>, Delay>, Output<'static>>>, > = StaticCell::new(); let stack = STACK.init(Stack::new( device, diff --git a/examples/nrf52840/src/bin/gpiote_port.rs b/examples/nrf52840/src/bin/gpiote_port.rs index c1afe2f20..0dddb1a97 100644 --- a/examples/nrf52840/src/bin/gpiote_port.rs +++ b/examples/nrf52840/src/bin/gpiote_port.rs @@ -3,11 +3,11 @@ use defmt::{info, unwrap}; use embassy_executor::Spawner; -use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull}; +use embassy_nrf::gpio::{Input, Pull}; use {defmt_rtt as _, panic_probe as _}; #[embassy_executor::task(pool_size = 4)] -async fn button_task(n: usize, mut pin: Input<'static, AnyPin>) { +async fn button_task(n: usize, mut pin: Input<'static>) { loop { pin.wait_for_low().await; info!("Button {:?} pressed!", n); @@ -21,10 +21,10 @@ async fn main(spawner: Spawner) { let p = embassy_nrf::init(Default::default()); info!("Starting!"); - let btn1 = Input::new(p.P0_11.degrade(), Pull::Up); - let btn2 = Input::new(p.P0_12.degrade(), Pull::Up); - let btn3 = Input::new(p.P0_24.degrade(), Pull::Up); - let btn4 = Input::new(p.P0_25.degrade(), Pull::Up); + let btn1 = Input::new(p.P0_11, Pull::Up); + let btn2 = Input::new(p.P0_12, Pull::Up); + let btn3 = Input::new(p.P0_24, Pull::Up); + let btn4 = Input::new(p.P0_25, Pull::Up); unwrap!(spawner.spawn(button_task(1, btn1))); unwrap!(spawner.spawn(button_task(2, btn2))); diff --git a/examples/nrf52840/src/bin/usb_hid_keyboard.rs b/examples/nrf52840/src/bin/usb_hid_keyboard.rs index 45850b4a4..3e86590c4 100644 --- a/examples/nrf52840/src/bin/usb_hid_keyboard.rs +++ b/examples/nrf52840/src/bin/usb_hid_keyboard.rs @@ -8,7 +8,7 @@ use defmt::*; use embassy_executor::Spawner; use embassy_futures::join::join; use embassy_futures::select::{select, Either}; -use embassy_nrf::gpio::{Input, Pin, Pull}; +use embassy_nrf::gpio::{Input, Pull}; use embassy_nrf::usb::vbus_detect::HardwareVbusDetect; use embassy_nrf::usb::Driver; use embassy_nrf::{bind_interrupts, pac, peripherals, usb}; @@ -97,7 +97,7 @@ async fn main(_spawner: Spawner) { } }; - let mut button = Input::new(p.P0_11.degrade(), Pull::Up); + let mut button = Input::new(p.P0_11, Pull::Up); let (reader, mut writer) = hid.split(); diff --git a/examples/nrf52840/src/bin/wifi_esp_hosted.rs b/examples/nrf52840/src/bin/wifi_esp_hosted.rs index fc2086f75..00bd50081 100644 --- a/examples/nrf52840/src/bin/wifi_esp_hosted.rs +++ b/examples/nrf52840/src/bin/wifi_esp_hosted.rs @@ -5,7 +5,7 @@ use defmt::{info, unwrap, warn}; use embassy_executor::Spawner; use embassy_net::tcp::TcpSocket; use embassy_net::{Stack, StackResources}; -use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull}; +use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull}; use embassy_nrf::rng::Rng; use embassy_nrf::spim::{self, Spim}; use embassy_nrf::{bind_interrupts, peripherals}; @@ -27,9 +27,9 @@ bind_interrupts!(struct Irqs { async fn wifi_task( runner: hosted::Runner< 'static, - ExclusiveDevice, Output<'static, peripherals::P0_31>, Delay>, - Input<'static, AnyPin>, - Output<'static, peripherals::P1_05>, + ExclusiveDevice, Output<'static>, Delay>, + Input<'static>, + Output<'static>, >, ) -> ! { runner.run().await @@ -50,8 +50,8 @@ async fn main(spawner: Spawner) { let sck = p.P0_29; let mosi = p.P0_30; let cs = Output::new(p.P0_31, Level::High, OutputDrive::HighDrive); - let handshake = Input::new(p.P1_01.degrade(), Pull::Up); - let ready = Input::new(p.P1_04.degrade(), Pull::None); + let handshake = Input::new(p.P1_01, Pull::Up); + let ready = Input::new(p.P1_04, Pull::None); let reset = Output::new(p.P1_05, Level::Low, OutputDrive::Standard); let mut config = spim::Config::default(); -- cgit