aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/rp/Cargo.toml5
-rw-r--r--examples/rp/src/bin/spi_display.rs12
-rw-r--r--examples/stm32h7/Cargo.toml3
-rw-r--r--examples/stm32l4/Cargo.toml3
-rw-r--r--examples/stm32l4/src/bin/usart_blocking_async.rs30
5 files changed, 13 insertions, 40 deletions
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml
index 2cce0af37..827adea23 100644
--- a/examples/rp/Cargo.toml
+++ b/examples/rp/Cargo.toml
@@ -20,7 +20,8 @@ futures = { version = "0.3.17", default-features = false, features = ["async-awa
20display-interface-spi = "0.4.1" 20display-interface-spi = "0.4.1"
21embedded-graphics = "0.7.1" 21embedded-graphics = "0.7.1"
22st7789 = "0.6.1" 22st7789 = "0.6.1"
23
24embedded-hal = { version = "1.0.0-alpha.7", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy2" }
25display-interface = "0.4.1" 23display-interface = "0.4.1"
26byte-slice-cast = { version = "1.2.0", default-features = false } 24byte-slice-cast = { version = "1.2.0", default-features = false }
25
26embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" }
27embedded-hal-async = { version = "0.1.0-alpha.0" }
diff --git a/examples/rp/src/bin/spi_display.rs b/examples/rp/src/bin/spi_display.rs
index bc93e0617..5c3c4c4c5 100644
--- a/examples/rp/src/bin/spi_display.rs
+++ b/examples/rp/src/bin/spi_display.rs
@@ -110,9 +110,9 @@ mod shared_spi {
110 use core::cell::RefCell; 110 use core::cell::RefCell;
111 use core::fmt::Debug; 111 use core::fmt::Debug;
112 112
113 use embedded_hal::digital::blocking::OutputPin; 113 use embedded_hal_1::digital::blocking::OutputPin;
114 use embedded_hal::spi; 114 use embedded_hal_1::spi;
115 use embedded_hal::spi::blocking::SpiDevice; 115 use embedded_hal_1::spi::blocking::SpiDevice;
116 116
117 #[derive(Copy, Clone, Eq, PartialEq, Debug)] 117 #[derive(Copy, Clone, Eq, PartialEq, Debug)]
118 pub enum SpiDeviceWithCsError<BUS, CS> { 118 pub enum SpiDeviceWithCsError<BUS, CS> {
@@ -184,7 +184,7 @@ mod shared_spi {
184 184
185/// Driver for the XPT2046 resistive touchscreen sensor 185/// Driver for the XPT2046 resistive touchscreen sensor
186mod touch { 186mod touch {
187 use embedded_hal::spi::blocking::{SpiBus, SpiBusRead, SpiBusWrite, SpiDevice}; 187 use embedded_hal_1::spi::blocking::{SpiBus, SpiBusRead, SpiBusWrite, SpiDevice};
188 188
189 struct Calibration { 189 struct Calibration {
190 x1: i32, 190 x1: i32,
@@ -248,8 +248,8 @@ mod touch {
248 248
249mod my_display_interface { 249mod my_display_interface {
250 use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand}; 250 use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand};
251 use embedded_hal::digital::blocking::OutputPin; 251 use embedded_hal_1::digital::blocking::OutputPin;
252 use embedded_hal::spi::blocking::{SpiBusWrite, SpiDevice}; 252 use embedded_hal_1::spi::blocking::{SpiBusWrite, SpiDevice};
253 253
254 /// SPI display interface. 254 /// SPI display interface.
255 /// 255 ///
diff --git a/examples/stm32h7/Cargo.toml b/examples/stm32h7/Cargo.toml
index f237a8173..419bbec31 100644
--- a/examples/stm32h7/Cargo.toml
+++ b/examples/stm32h7/Cargo.toml
@@ -18,7 +18,8 @@ defmt-rtt = "0.3"
18cortex-m = "0.7.3" 18cortex-m = "0.7.3"
19cortex-m-rt = "0.7.0" 19cortex-m-rt = "0.7.0"
20embedded-hal = "0.2.6" 20embedded-hal = "0.2.6"
21embedded-hal-async = { version = "0.0.1", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy2"} 21embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" }
22embedded-hal-async = { version = "0.1.0-alpha.0" }
22panic-probe = { version = "0.3", features = ["print-defmt"] } 23panic-probe = { version = "0.3", features = ["print-defmt"] }
23futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 24futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
24heapless = { version = "0.7.5", default-features = false } 25heapless = { version = "0.7.5", default-features = false }
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml
index 5838d01db..2da549bb2 100644
--- a/examples/stm32l4/Cargo.toml
+++ b/examples/stm32l4/Cargo.toml
@@ -18,7 +18,8 @@ defmt-rtt = "0.3"
18cortex-m = "0.7.3" 18cortex-m = "0.7.3"
19cortex-m-rt = "0.7.0" 19cortex-m-rt = "0.7.0"
20embedded-hal = "0.2.6" 20embedded-hal = "0.2.6"
21embedded-hal-async = { version = "0.0.1", git = "https://github.com/embassy-rs/embedded-hal", branch = "embassy2"} 21embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" }
22embedded-hal-async = { version = "0.1.0-alpha.0" }
22panic-probe = { version = "0.3", features = ["print-defmt"] } 23panic-probe = { version = "0.3", features = ["print-defmt"] }
23futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 24futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
24heapless = { version = "0.7.5", default-features = false } 25heapless = { version = "0.7.5", default-features = false }
diff --git a/examples/stm32l4/src/bin/usart_blocking_async.rs b/examples/stm32l4/src/bin/usart_blocking_async.rs
deleted file mode 100644
index 7efccace5..000000000
--- a/examples/stm32l4/src/bin/usart_blocking_async.rs
+++ /dev/null
@@ -1,30 +0,0 @@
1#![no_std]
2#![no_main]
3#![feature(type_alias_impl_trait)]
4
5use defmt_rtt as _; // global logger
6use panic_probe as _;
7
8use defmt::*;
9use embassy::executor::Spawner;
10use embassy_stm32::dma::NoDma;
11use embassy_stm32::usart::{Config, Uart};
12use embassy_stm32::Peripherals;
13use embassy_traits::adapter::BlockingAsync;
14use embedded_hal_async::serial::{Read, Write};
15
16#[embassy::main]
17async fn main(_spawner: Spawner, p: Peripherals) {
18 let config = Config::default();
19 let usart = Uart::new(p.UART4, p.PA1, p.PA0, NoDma, NoDma, config);
20 let mut usart = BlockingAsync::new(usart);
21
22 unwrap!(usart.write(b"Hello Embassy World!\r\n").await);
23 info!("wrote Hello, starting echo");
24
25 let mut buf = [0u8; 1];
26 loop {
27 unwrap!(usart.read(&mut buf).await);
28 unwrap!(usart.write(&buf).await);
29 }
30}