aboutsummaryrefslogtreecommitdiff
path: root/examples/rp
diff options
context:
space:
mode:
authorMathias <[email protected]>2022-08-18 21:08:57 +0200
committerMathias <[email protected]>2022-08-18 21:08:57 +0200
commita7d6bc7ba5faef3d711b944baf6c8e3685fdb37e (patch)
treed35085173fb8e4a0ff3b6357e3aaef18c6124e6e /examples/rp
parent9c9b7b1a66dc90a9183886867811d2db57df714c (diff)
parentaefa5275a2ab2cac6caef599e7adb76ce1beeddd (diff)
Merge branch 'master' of https://github.com/embassy-rs/embassy into embassy-rp/dma
Diffstat (limited to 'examples/rp')
-rw-r--r--examples/rp/Cargo.toml6
-rw-r--r--examples/rp/src/bin/blinky.rs9
-rw-r--r--examples/rp/src/bin/button.rs6
-rw-r--r--examples/rp/src/bin/gpio_async.rs9
-rw-r--r--examples/rp/src/bin/spi.rs7
-rw-r--r--examples/rp/src/bin/spi_display.rs9
-rw-r--r--examples/rp/src/bin/uart.rs7
7 files changed, 29 insertions, 24 deletions
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml
index 94c3d8013..c2dcf429a 100644
--- a/examples/rp/Cargo.toml
+++ b/examples/rp/Cargo.toml
@@ -6,14 +6,14 @@ version = "0.1.0"
6 6
7[dependencies] 7[dependencies]
8embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] } 8embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] }
9embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime"] } 9embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "integrated-timers"] }
10embassy-time = { version = "0.1.0", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime"] }
10embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac"] } 11embassy-rp = { version = "0.1.0", path = "../../embassy-rp", features = ["defmt", "unstable-traits", "nightly", "unstable-pac"] }
11atomic-polyfill = "0.1.5"
12 12
13defmt = "0.3" 13defmt = "0.3"
14defmt-rtt = "0.3" 14defmt-rtt = "0.3"
15 15
16cortex-m = "0.7.3" 16cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
17cortex-m-rt = "0.7.0" 17cortex-m-rt = "0.7.0"
18panic-probe = { version = "0.3", features = ["print-defmt"] } 18panic-probe = { version = "0.3", features = ["print-defmt"] }
19futures = { version = "0.3.17", default-features = false, features = ["async-await", "cfg-target-has-atomic", "unstable"] } 19futures = { version = "0.3.17", default-features = false, features = ["async-await", "cfg-target-has-atomic", "unstable"] }
diff --git a/examples/rp/src/bin/blinky.rs b/examples/rp/src/bin/blinky.rs
index e53fca1af..7aa36a19f 100644
--- a/examples/rp/src/bin/blinky.rs
+++ b/examples/rp/src/bin/blinky.rs
@@ -3,14 +3,15 @@
3#![feature(type_alias_impl_trait)] 3#![feature(type_alias_impl_trait)]
4 4
5use defmt::*; 5use defmt::*;
6use embassy_executor::executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_executor::time::{Duration, Timer}; 7use embassy_rp::gpio;
8use embassy_rp::{gpio, Peripherals}; 8use embassy_time::{Duration, Timer};
9use gpio::{Level, Output}; 9use gpio::{Level, Output};
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12#[embassy_executor::main] 12#[embassy_executor::main]
13async fn main(_spawner: Spawner, p: Peripherals) { 13async fn main(_spawner: Spawner) {
14 let p = embassy_rp::init(Default::default());
14 let mut led = Output::new(p.PIN_25, Level::Low); 15 let mut led = Output::new(p.PIN_25, Level::Low);
15 16
16 loop { 17 loop {
diff --git a/examples/rp/src/bin/button.rs b/examples/rp/src/bin/button.rs
index 02cbc9416..c5422c616 100644
--- a/examples/rp/src/bin/button.rs
+++ b/examples/rp/src/bin/button.rs
@@ -2,13 +2,13 @@
2#![no_main] 2#![no_main]
3#![feature(type_alias_impl_trait)] 3#![feature(type_alias_impl_trait)]
4 4
5use embassy_executor::executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_rp::gpio::{Input, Level, Output, Pull}; 6use embassy_rp::gpio::{Input, Level, Output, Pull};
7use embassy_rp::Peripherals;
8use {defmt_rtt as _, panic_probe as _}; 7use {defmt_rtt as _, panic_probe as _};
9 8
10#[embassy_executor::main] 9#[embassy_executor::main]
11async fn main(_spawner: Spawner, p: Peripherals) { 10async fn main(_spawner: Spawner) {
11 let p = embassy_rp::init(Default::default());
12 let button = Input::new(p.PIN_28, Pull::Up); 12 let button = Input::new(p.PIN_28, Pull::Up);
13 let mut led = Output::new(p.PIN_25, Level::Low); 13 let mut led = Output::new(p.PIN_25, Level::Low);
14 14
diff --git a/examples/rp/src/bin/gpio_async.rs b/examples/rp/src/bin/gpio_async.rs
index ba905b015..52d13a9d5 100644
--- a/examples/rp/src/bin/gpio_async.rs
+++ b/examples/rp/src/bin/gpio_async.rs
@@ -3,9 +3,9 @@
3#![feature(type_alias_impl_trait)] 3#![feature(type_alias_impl_trait)]
4 4
5use defmt::*; 5use defmt::*;
6use embassy_executor::executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_executor::time::{Duration, Timer}; 7use embassy_rp::gpio;
8use embassy_rp::{gpio, Peripherals}; 8use embassy_time::{Duration, Timer};
9use gpio::{Input, Level, Output, Pull}; 9use gpio::{Input, Level, Output, Pull};
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
@@ -20,7 +20,8 @@ use {defmt_rtt as _, panic_probe as _};
20/// continue and turn off the LED, and then wait for 2 seconds before completing 20/// continue and turn off the LED, and then wait for 2 seconds before completing
21/// the loop and starting over again. 21/// the loop and starting over again.
22#[embassy_executor::main] 22#[embassy_executor::main]
23async fn main(_spawner: Spawner, p: Peripherals) { 23async fn main(_spawner: Spawner) {
24 let p = embassy_rp::init(Default::default());
24 let mut led = Output::new(p.PIN_25, Level::Low); 25 let mut led = Output::new(p.PIN_25, Level::Low);
25 let mut async_input = Input::new(p.PIN_16, Pull::None); 26 let mut async_input = Input::new(p.PIN_16, Pull::None);
26 27
diff --git a/examples/rp/src/bin/spi.rs b/examples/rp/src/bin/spi.rs
index a3160c106..88003ee17 100644
--- a/examples/rp/src/bin/spi.rs
+++ b/examples/rp/src/bin/spi.rs
@@ -3,14 +3,15 @@
3#![feature(type_alias_impl_trait)] 3#![feature(type_alias_impl_trait)]
4 4
5use defmt::*; 5use defmt::*;
6use embassy_executor::executor::Spawner; 6use embassy_executor::Spawner;
7use embassy_rp::spi::Spi; 7use embassy_rp::spi::Spi;
8use embassy_rp::{gpio, spi, Peripherals}; 8use embassy_rp::{gpio, spi};
9use gpio::{Level, Output}; 9use gpio::{Level, Output};
10use {defmt_rtt as _, panic_probe as _}; 10use {defmt_rtt as _, panic_probe as _};
11 11
12#[embassy_executor::main] 12#[embassy_executor::main]
13async fn main(_spawner: Spawner, p: Peripherals) { 13async fn main(_spawner: Spawner) {
14 let p = embassy_rp::init(Default::default());
14 info!("Hello World!"); 15 info!("Hello World!");
15 16
16 // Example for resistive touch sensor in Waveshare Pico-ResTouch 17 // Example for resistive touch sensor in Waveshare Pico-ResTouch
diff --git a/examples/rp/src/bin/spi_display.rs b/examples/rp/src/bin/spi_display.rs
index 2760b23fa..f0e54d87f 100644
--- a/examples/rp/src/bin/spi_display.rs
+++ b/examples/rp/src/bin/spi_display.rs
@@ -5,11 +5,11 @@
5use core::cell::RefCell; 5use core::cell::RefCell;
6 6
7use defmt::*; 7use defmt::*;
8use embassy_executor::executor::Spawner; 8use embassy_executor::Spawner;
9use embassy_executor::time::Delay;
10use embassy_rp::gpio::{Level, Output}; 9use embassy_rp::gpio::{Level, Output};
10use embassy_rp::spi;
11use embassy_rp::spi::Spi; 11use embassy_rp::spi::Spi;
12use embassy_rp::{spi, Peripherals}; 12use embassy_time::Delay;
13use embedded_graphics::image::{Image, ImageRawLE}; 13use embedded_graphics::image::{Image, ImageRawLE};
14use embedded_graphics::mono_font::ascii::FONT_10X20; 14use embedded_graphics::mono_font::ascii::FONT_10X20;
15use embedded_graphics::mono_font::MonoTextStyle; 15use embedded_graphics::mono_font::MonoTextStyle;
@@ -28,7 +28,8 @@ use crate::touch::Touch;
28const TOUCH_FREQ: u32 = 200_000; 28const TOUCH_FREQ: u32 = 200_000;
29 29
30#[embassy_executor::main] 30#[embassy_executor::main]
31async fn main(_spawner: Spawner, p: Peripherals) { 31async fn main(_spawner: Spawner) {
32 let p = embassy_rp::init(Default::default());
32 info!("Hello World!"); 33 info!("Hello World!");
33 34
34 let bl = p.PIN_13; 35 let bl = p.PIN_13;
diff --git a/examples/rp/src/bin/uart.rs b/examples/rp/src/bin/uart.rs
index b7014c55a..c63b31cae 100644
--- a/examples/rp/src/bin/uart.rs
+++ b/examples/rp/src/bin/uart.rs
@@ -2,12 +2,13 @@
2#![no_main] 2#![no_main]
3#![feature(type_alias_impl_trait)] 3#![feature(type_alias_impl_trait)]
4 4
5use embassy_executor::executor::Spawner; 5use embassy_executor::Spawner;
6use embassy_rp::{uart, Peripherals}; 6use embassy_rp::uart;
7use {defmt_rtt as _, panic_probe as _}; 7use {defmt_rtt as _, panic_probe as _};
8 8
9#[embassy_executor::main] 9#[embassy_executor::main]
10async fn main(_spawner: Spawner, p: Peripherals) { 10async fn main(_spawner: Spawner) {
11 let p = embassy_rp::init(Default::default());
11 let config = uart::Config::default(); 12 let config = uart::Config::default();
12 let mut uart = uart::Uart::new_with_rtscts(p.UART0, p.PIN_0, p.PIN_1, p.PIN_2, p.PIN_3, config); 13 let mut uart = uart::Uart::new_with_rtscts(p.UART0, p.PIN_0, p.PIN_1, p.PIN_2, p.PIN_3, config);
13 uart.blocking_write("Hello World!\r\n".as_bytes()).unwrap(); 14 uart.blocking_write("Hello World!\r\n".as_bytes()).unwrap();