aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/nrf52840/src/bin/ethernet_enc28j60.rs12
-rw-r--r--examples/nrf52840/src/bin/gpiote_port.rs12
-rw-r--r--examples/nrf52840/src/bin/usb_hid_keyboard.rs4
-rw-r--r--examples/nrf52840/src/bin/wifi_esp_hosted.rs12
4 files changed, 16 insertions, 24 deletions
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 {
24#[embassy_executor::task] 24#[embassy_executor::task]
25async fn net_task( 25async fn net_task(
26 stack: &'static Stack< 26 stack: &'static Stack<
27 Enc28j60< 27 Enc28j60<ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static>, Delay>, Output<'static>>,
28 ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static, peripherals::P0_15>, Delay>,
29 Output<'static, peripherals::P0_13>,
30 >,
31 >, 28 >,
32) -> ! { 29) -> ! {
33 stack.run().await 30 stack.run().await
@@ -71,12 +68,7 @@ async fn main(spawner: Spawner) {
71 // Init network stack 68 // Init network stack
72 static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new(); 69 static RESOURCES: StaticCell<StackResources<2>> = StaticCell::new();
73 static STACK: StaticCell< 70 static STACK: StaticCell<
74 Stack< 71 Stack<Enc28j60<ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static>, Delay>, Output<'static>>>,
75 Enc28j60<
76 ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static, peripherals::P0_15>, Delay>,
77 Output<'static, peripherals::P0_13>,
78 >,
79 >,
80 > = StaticCell::new(); 72 > = StaticCell::new();
81 let stack = STACK.init(Stack::new( 73 let stack = STACK.init(Stack::new(
82 device, 74 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 @@
3 3
4use defmt::{info, unwrap}; 4use defmt::{info, unwrap};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_nrf::gpio::{AnyPin, Input, Pin as _, Pull}; 6use embassy_nrf::gpio::{Input, Pull};
7use {defmt_rtt as _, panic_probe as _}; 7use {defmt_rtt as _, panic_probe as _};
8 8
9#[embassy_executor::task(pool_size = 4)] 9#[embassy_executor::task(pool_size = 4)]
10async fn button_task(n: usize, mut pin: Input<'static, AnyPin>) { 10async fn button_task(n: usize, mut pin: Input<'static>) {
11 loop { 11 loop {
12 pin.wait_for_low().await; 12 pin.wait_for_low().await;
13 info!("Button {:?} pressed!", n); 13 info!("Button {:?} pressed!", n);
@@ -21,10 +21,10 @@ async fn main(spawner: Spawner) {
21 let p = embassy_nrf::init(Default::default()); 21 let p = embassy_nrf::init(Default::default());
22 info!("Starting!"); 22 info!("Starting!");
23 23
24 let btn1 = Input::new(p.P0_11.degrade(), Pull::Up); 24 let btn1 = Input::new(p.P0_11, Pull::Up);
25 let btn2 = Input::new(p.P0_12.degrade(), Pull::Up); 25 let btn2 = Input::new(p.P0_12, Pull::Up);
26 let btn3 = Input::new(p.P0_24.degrade(), Pull::Up); 26 let btn3 = Input::new(p.P0_24, Pull::Up);
27 let btn4 = Input::new(p.P0_25.degrade(), Pull::Up); 27 let btn4 = Input::new(p.P0_25, Pull::Up);
28 28
29 unwrap!(spawner.spawn(button_task(1, btn1))); 29 unwrap!(spawner.spawn(button_task(1, btn1)));
30 unwrap!(spawner.spawn(button_task(2, btn2))); 30 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::*;
8use embassy_executor::Spawner; 8use embassy_executor::Spawner;
9use embassy_futures::join::join; 9use embassy_futures::join::join;
10use embassy_futures::select::{select, Either}; 10use embassy_futures::select::{select, Either};
11use embassy_nrf::gpio::{Input, Pin, Pull}; 11use embassy_nrf::gpio::{Input, Pull};
12use embassy_nrf::usb::vbus_detect::HardwareVbusDetect; 12use embassy_nrf::usb::vbus_detect::HardwareVbusDetect;
13use embassy_nrf::usb::Driver; 13use embassy_nrf::usb::Driver;
14use embassy_nrf::{bind_interrupts, pac, peripherals, usb}; 14use embassy_nrf::{bind_interrupts, pac, peripherals, usb};
@@ -97,7 +97,7 @@ async fn main(_spawner: Spawner) {
97 } 97 }
98 }; 98 };
99 99
100 let mut button = Input::new(p.P0_11.degrade(), Pull::Up); 100 let mut button = Input::new(p.P0_11, Pull::Up);
101 101
102 let (reader, mut writer) = hid.split(); 102 let (reader, mut writer) = hid.split();
103 103
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};
5use embassy_executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_net::tcp::TcpSocket; 6use embassy_net::tcp::TcpSocket;
7use embassy_net::{Stack, StackResources}; 7use embassy_net::{Stack, StackResources};
8use embassy_nrf::gpio::{AnyPin, Input, Level, Output, OutputDrive, Pin, Pull}; 8use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pull};
9use embassy_nrf::rng::Rng; 9use embassy_nrf::rng::Rng;
10use embassy_nrf::spim::{self, Spim}; 10use embassy_nrf::spim::{self, Spim};
11use embassy_nrf::{bind_interrupts, peripherals}; 11use embassy_nrf::{bind_interrupts, peripherals};
@@ -27,9 +27,9 @@ bind_interrupts!(struct Irqs {
27async fn wifi_task( 27async fn wifi_task(
28 runner: hosted::Runner< 28 runner: hosted::Runner<
29 'static, 29 'static,
30 ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static, peripherals::P0_31>, Delay>, 30 ExclusiveDevice<Spim<'static, peripherals::SPI3>, Output<'static>, Delay>,
31 Input<'static, AnyPin>, 31 Input<'static>,
32 Output<'static, peripherals::P1_05>, 32 Output<'static>,
33 >, 33 >,
34) -> ! { 34) -> ! {
35 runner.run().await 35 runner.run().await
@@ -50,8 +50,8 @@ async fn main(spawner: Spawner) {
50 let sck = p.P0_29; 50 let sck = p.P0_29;
51 let mosi = p.P0_30; 51 let mosi = p.P0_30;
52 let cs = Output::new(p.P0_31, Level::High, OutputDrive::HighDrive); 52 let cs = Output::new(p.P0_31, Level::High, OutputDrive::HighDrive);
53 let handshake = Input::new(p.P1_01.degrade(), Pull::Up); 53 let handshake = Input::new(p.P1_01, Pull::Up);
54 let ready = Input::new(p.P1_04.degrade(), Pull::None); 54 let ready = Input::new(p.P1_04, Pull::None);
55 let reset = Output::new(p.P1_05, Level::Low, OutputDrive::Standard); 55 let reset = Output::new(p.P1_05, Level::Low, OutputDrive::Standard);
56 56
57 let mut config = spim::Config::default(); 57 let mut config = spim::Config::default();