diff options
Diffstat (limited to 'examples/rp')
| -rw-r--r-- | examples/rp/Cargo.toml | 7 | ||||
| -rw-r--r-- | examples/rp/src/bin/ethernet_w5500_multisocket.rs | 14 | ||||
| -rw-r--r-- | examples/rp/src/bin/ethernet_w5500_tcp_client.rs | 14 | ||||
| -rw-r--r-- | examples/rp/src/bin/ethernet_w5500_tcp_server.rs | 14 | ||||
| -rw-r--r-- | examples/rp/src/bin/ethernet_w5500_udp.rs | 13 | ||||
| -rw-r--r-- | examples/rp/src/bin/spi_display.rs | 8 |
6 files changed, 49 insertions, 21 deletions
diff --git a/examples/rp/Cargo.toml b/examples/rp/Cargo.toml index 48f3a26bb..17ebea86f 100644 --- a/examples/rp/Cargo.toml +++ b/examples/rp/Cargo.toml | |||
| @@ -41,8 +41,8 @@ byte-slice-cast = { version = "1.2.0", default-features = false } | |||
| 41 | smart-leds = "0.3.0" | 41 | smart-leds = "0.3.0" |
| 42 | heapless = "0.7.15" | 42 | heapless = "0.7.15" |
| 43 | 43 | ||
| 44 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.10" } | 44 | embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.11" } |
| 45 | embedded-hal-async = "0.2.0-alpha.1" | 45 | embedded-hal-async = "0.2.0-alpha.2" |
| 46 | embedded-io = { version = "0.4.0", features = ["async", "defmt"] } | 46 | embedded-io = { version = "0.4.0", features = ["async", "defmt"] } |
| 47 | embedded-storage = { version = "0.3" } | 47 | embedded-storage = { version = "0.3" } |
| 48 | static_cell = { version = "1.1", features = ["nightly"]} | 48 | static_cell = { version = "1.1", features = ["nightly"]} |
| @@ -53,3 +53,6 @@ rand = { version = "0.8.5", default-features = false } | |||
| 53 | 53 | ||
| 54 | [profile.release] | 54 | [profile.release] |
| 55 | debug = true | 55 | debug = true |
| 56 | |||
| 57 | [patch.crates-io] | ||
| 58 | lora-phy = { git = "https://github.com/embassy-rs/lora-phy", rev = "ad289428fd44b02788e2fa2116445cc8f640a265" } | ||
diff --git a/examples/rp/src/bin/ethernet_w5500_multisocket.rs b/examples/rp/src/bin/ethernet_w5500_multisocket.rs index 82568254a..e81da177b 100644 --- a/examples/rp/src/bin/ethernet_w5500_multisocket.rs +++ b/examples/rp/src/bin/ethernet_w5500_multisocket.rs | |||
| @@ -15,7 +15,7 @@ use embassy_rp::clocks::RoscRng; | |||
| 15 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 15 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 16 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; | 16 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; |
| 17 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | 17 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; |
| 18 | use embassy_time::Duration; | 18 | use embassy_time::{Delay, Duration}; |
| 19 | use embedded_hal_async::spi::ExclusiveDevice; | 19 | use embedded_hal_async::spi::ExclusiveDevice; |
| 20 | use embedded_io::asynch::Write; | 20 | use embedded_io::asynch::Write; |
| 21 | use rand::RngCore; | 21 | use rand::RngCore; |
| @@ -26,7 +26,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 26 | async fn ethernet_task( | 26 | async fn ethernet_task( |
| 27 | runner: Runner< | 27 | runner: Runner< |
| 28 | 'static, | 28 | 'static, |
| 29 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>>, | 29 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, |
| 30 | Input<'static, PIN_21>, | 30 | Input<'static, PIN_21>, |
| 31 | Output<'static, PIN_20>, | 31 | Output<'static, PIN_20>, |
| 32 | >, | 32 | >, |
| @@ -54,8 +54,14 @@ async fn main(spawner: Spawner) { | |||
| 54 | 54 | ||
| 55 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; | 55 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; |
| 56 | let state = make_static!(State::<8, 8>::new()); | 56 | let state = make_static!(State::<8, 8>::new()); |
| 57 | let (device, runner) = | 57 | let (device, runner) = embassy_net_w5500::new( |
| 58 | embassy_net_w5500::new(mac_addr, state, ExclusiveDevice::new(spi, cs), w5500_int, w5500_reset).await; | 58 | mac_addr, |
| 59 | state, | ||
| 60 | ExclusiveDevice::new(spi, cs, Delay), | ||
| 61 | w5500_int, | ||
| 62 | w5500_reset, | ||
| 63 | ) | ||
| 64 | .await; | ||
| 59 | unwrap!(spawner.spawn(ethernet_task(runner))); | 65 | unwrap!(spawner.spawn(ethernet_task(runner))); |
| 60 | 66 | ||
| 61 | // Generate random seed | 67 | // Generate random seed |
diff --git a/examples/rp/src/bin/ethernet_w5500_tcp_client.rs b/examples/rp/src/bin/ethernet_w5500_tcp_client.rs index d562defad..9dd7ae973 100644 --- a/examples/rp/src/bin/ethernet_w5500_tcp_client.rs +++ b/examples/rp/src/bin/ethernet_w5500_tcp_client.rs | |||
| @@ -17,7 +17,7 @@ use embassy_rp::clocks::RoscRng; | |||
| 17 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 17 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 18 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; | 18 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; |
| 19 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | 19 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; |
| 20 | use embassy_time::{Duration, Timer}; | 20 | use embassy_time::{Delay, Duration, Timer}; |
| 21 | use embedded_hal_async::spi::ExclusiveDevice; | 21 | use embedded_hal_async::spi::ExclusiveDevice; |
| 22 | use embedded_io::asynch::Write; | 22 | use embedded_io::asynch::Write; |
| 23 | use rand::RngCore; | 23 | use rand::RngCore; |
| @@ -28,7 +28,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 28 | async fn ethernet_task( | 28 | async fn ethernet_task( |
| 29 | runner: Runner< | 29 | runner: Runner< |
| 30 | 'static, | 30 | 'static, |
| 31 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>>, | 31 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, |
| 32 | Input<'static, PIN_21>, | 32 | Input<'static, PIN_21>, |
| 33 | Output<'static, PIN_20>, | 33 | Output<'static, PIN_20>, |
| 34 | >, | 34 | >, |
| @@ -57,8 +57,14 @@ async fn main(spawner: Spawner) { | |||
| 57 | 57 | ||
| 58 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; | 58 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; |
| 59 | let state = make_static!(State::<8, 8>::new()); | 59 | let state = make_static!(State::<8, 8>::new()); |
| 60 | let (device, runner) = | 60 | let (device, runner) = embassy_net_w5500::new( |
| 61 | embassy_net_w5500::new(mac_addr, state, ExclusiveDevice::new(spi, cs), w5500_int, w5500_reset).await; | 61 | mac_addr, |
| 62 | state, | ||
| 63 | ExclusiveDevice::new(spi, cs, Delay), | ||
| 64 | w5500_int, | ||
| 65 | w5500_reset, | ||
| 66 | ) | ||
| 67 | .await; | ||
| 62 | unwrap!(spawner.spawn(ethernet_task(runner))); | 68 | unwrap!(spawner.spawn(ethernet_task(runner))); |
| 63 | 69 | ||
| 64 | // Generate random seed | 70 | // Generate random seed |
diff --git a/examples/rp/src/bin/ethernet_w5500_tcp_server.rs b/examples/rp/src/bin/ethernet_w5500_tcp_server.rs index 7f521cdb4..db21c2b6f 100644 --- a/examples/rp/src/bin/ethernet_w5500_tcp_server.rs +++ b/examples/rp/src/bin/ethernet_w5500_tcp_server.rs | |||
| @@ -16,7 +16,7 @@ use embassy_rp::clocks::RoscRng; | |||
| 16 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 16 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 17 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; | 17 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; |
| 18 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | 18 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; |
| 19 | use embassy_time::Duration; | 19 | use embassy_time::{Delay, Duration}; |
| 20 | use embedded_hal_async::spi::ExclusiveDevice; | 20 | use embedded_hal_async::spi::ExclusiveDevice; |
| 21 | use embedded_io::asynch::Write; | 21 | use embedded_io::asynch::Write; |
| 22 | use rand::RngCore; | 22 | use rand::RngCore; |
| @@ -26,7 +26,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 26 | async fn ethernet_task( | 26 | async fn ethernet_task( |
| 27 | runner: Runner< | 27 | runner: Runner< |
| 28 | 'static, | 28 | 'static, |
| 29 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>>, | 29 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, |
| 30 | Input<'static, PIN_21>, | 30 | Input<'static, PIN_21>, |
| 31 | Output<'static, PIN_20>, | 31 | Output<'static, PIN_20>, |
| 32 | >, | 32 | >, |
| @@ -55,8 +55,14 @@ async fn main(spawner: Spawner) { | |||
| 55 | 55 | ||
| 56 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; | 56 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; |
| 57 | let state = make_static!(State::<8, 8>::new()); | 57 | let state = make_static!(State::<8, 8>::new()); |
| 58 | let (device, runner) = | 58 | let (device, runner) = embassy_net_w5500::new( |
| 59 | embassy_net_w5500::new(mac_addr, state, ExclusiveDevice::new(spi, cs), w5500_int, w5500_reset).await; | 59 | mac_addr, |
| 60 | state, | ||
| 61 | ExclusiveDevice::new(spi, cs, Delay), | ||
| 62 | w5500_int, | ||
| 63 | w5500_reset, | ||
| 64 | ) | ||
| 65 | .await; | ||
| 60 | unwrap!(spawner.spawn(ethernet_task(runner))); | 66 | unwrap!(spawner.spawn(ethernet_task(runner))); |
| 61 | 67 | ||
| 62 | // Generate random seed | 68 | // Generate random seed |
diff --git a/examples/rp/src/bin/ethernet_w5500_udp.rs b/examples/rp/src/bin/ethernet_w5500_udp.rs index ada86ae55..038432b17 100644 --- a/examples/rp/src/bin/ethernet_w5500_udp.rs +++ b/examples/rp/src/bin/ethernet_w5500_udp.rs | |||
| @@ -16,6 +16,7 @@ use embassy_rp::clocks::RoscRng; | |||
| 16 | use embassy_rp::gpio::{Input, Level, Output, Pull}; | 16 | use embassy_rp::gpio::{Input, Level, Output, Pull}; |
| 17 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; | 17 | use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; |
| 18 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; | 18 | use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; |
| 19 | use embassy_time::Delay; | ||
| 19 | use embedded_hal_async::spi::ExclusiveDevice; | 20 | use embedded_hal_async::spi::ExclusiveDevice; |
| 20 | use rand::RngCore; | 21 | use rand::RngCore; |
| 21 | use static_cell::make_static; | 22 | use static_cell::make_static; |
| @@ -24,7 +25,7 @@ use {defmt_rtt as _, panic_probe as _}; | |||
| 24 | async fn ethernet_task( | 25 | async fn ethernet_task( |
| 25 | runner: Runner< | 26 | runner: Runner< |
| 26 | 'static, | 27 | 'static, |
| 27 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>>, | 28 | ExclusiveDevice<Spi<'static, SPI0, Async>, Output<'static, PIN_17>, Delay>, |
| 28 | Input<'static, PIN_21>, | 29 | Input<'static, PIN_21>, |
| 29 | Output<'static, PIN_20>, | 30 | Output<'static, PIN_20>, |
| 30 | >, | 31 | >, |
| @@ -52,8 +53,14 @@ async fn main(spawner: Spawner) { | |||
| 52 | 53 | ||
| 53 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; | 54 | let mac_addr = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00]; |
| 54 | let state = make_static!(State::<8, 8>::new()); | 55 | let state = make_static!(State::<8, 8>::new()); |
| 55 | let (device, runner) = | 56 | let (device, runner) = embassy_net_w5500::new( |
| 56 | embassy_net_w5500::new(mac_addr, state, ExclusiveDevice::new(spi, cs), w5500_int, w5500_reset).await; | 57 | mac_addr, |
| 58 | state, | ||
| 59 | ExclusiveDevice::new(spi, cs, Delay), | ||
| 60 | w5500_int, | ||
| 61 | w5500_reset, | ||
| 62 | ) | ||
| 63 | .await; | ||
| 57 | unwrap!(spawner.spawn(ethernet_task(runner))); | 64 | unwrap!(spawner.spawn(ethernet_task(runner))); |
| 58 | 65 | ||
| 59 | // Generate random seed | 66 | // Generate random seed |
diff --git a/examples/rp/src/bin/spi_display.rs b/examples/rp/src/bin/spi_display.rs index 85a19ce07..2fd201595 100644 --- a/examples/rp/src/bin/spi_display.rs +++ b/examples/rp/src/bin/spi_display.rs | |||
| @@ -175,7 +175,7 @@ mod touch { | |||
| 175 | mod my_display_interface { | 175 | mod my_display_interface { |
| 176 | use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand}; | 176 | use display_interface::{DataFormat, DisplayError, WriteOnlyDataCommand}; |
| 177 | use embedded_hal_1::digital::OutputPin; | 177 | use embedded_hal_1::digital::OutputPin; |
| 178 | use embedded_hal_1::spi::SpiDeviceWrite; | 178 | use embedded_hal_1::spi::SpiDevice; |
| 179 | 179 | ||
| 180 | /// SPI display interface. | 180 | /// SPI display interface. |
| 181 | /// | 181 | /// |
| @@ -187,7 +187,7 @@ mod my_display_interface { | |||
| 187 | 187 | ||
| 188 | impl<SPI, DC> SPIDeviceInterface<SPI, DC> | 188 | impl<SPI, DC> SPIDeviceInterface<SPI, DC> |
| 189 | where | 189 | where |
| 190 | SPI: SpiDeviceWrite, | 190 | SPI: SpiDevice, |
| 191 | DC: OutputPin, | 191 | DC: OutputPin, |
| 192 | { | 192 | { |
| 193 | /// Create new SPI interface for communciation with a display driver | 193 | /// Create new SPI interface for communciation with a display driver |
| @@ -198,7 +198,7 @@ mod my_display_interface { | |||
| 198 | 198 | ||
| 199 | impl<SPI, DC> WriteOnlyDataCommand for SPIDeviceInterface<SPI, DC> | 199 | impl<SPI, DC> WriteOnlyDataCommand for SPIDeviceInterface<SPI, DC> |
| 200 | where | 200 | where |
| 201 | SPI: SpiDeviceWrite, | 201 | SPI: SpiDevice, |
| 202 | DC: OutputPin, | 202 | DC: OutputPin, |
| 203 | { | 203 | { |
| 204 | fn send_commands(&mut self, cmds: DataFormat<'_>) -> Result<(), DisplayError> { | 204 | fn send_commands(&mut self, cmds: DataFormat<'_>) -> Result<(), DisplayError> { |
| @@ -218,7 +218,7 @@ mod my_display_interface { | |||
| 218 | } | 218 | } |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | fn send_u8<T: SpiDeviceWrite>(spi: &mut T, words: DataFormat<'_>) -> Result<(), T::Error> { | 221 | fn send_u8<T: SpiDevice>(spi: &mut T, words: DataFormat<'_>) -> Result<(), T::Error> { |
| 222 | match words { | 222 | match words { |
| 223 | DataFormat::U8(slice) => spi.write(slice), | 223 | DataFormat::U8(slice) => spi.write(slice), |
| 224 | DataFormat::U16(slice) => { | 224 | DataFormat::U16(slice) => { |
