aboutsummaryrefslogtreecommitdiff
path: root/examples/rp/src
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-07-04 19:53:06 +0200
committerDario Nieuwenhuis <[email protected]>2023-07-04 19:59:36 +0200
commita101d9078deb3ad576a40b6d5f4d6e81dcfd528e (patch)
tree98deed296973aa29dc1701f69ecbe342d2a2c7c5 /examples/rp/src
parentb2f843a4ce2dc9114a135f612e1a408a8fe02fab (diff)
update embedded-hal crates.
Diffstat (limited to 'examples/rp/src')
-rw-r--r--examples/rp/src/bin/ethernet_w5500_multisocket.rs14
-rw-r--r--examples/rp/src/bin/ethernet_w5500_tcp_client.rs14
-rw-r--r--examples/rp/src/bin/ethernet_w5500_tcp_server.rs14
-rw-r--r--examples/rp/src/bin/ethernet_w5500_udp.rs13
-rw-r--r--examples/rp/src/bin/spi_display.rs8
5 files changed, 44 insertions, 19 deletions
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;
15use embassy_rp::gpio::{Input, Level, Output, Pull}; 15use embassy_rp::gpio::{Input, Level, Output, Pull};
16use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; 16use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0};
17use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; 17use embassy_rp::spi::{Async, Config as SpiConfig, Spi};
18use embassy_time::Duration; 18use embassy_time::{Delay, Duration};
19use embedded_hal_async::spi::ExclusiveDevice; 19use embedded_hal_async::spi::ExclusiveDevice;
20use embedded_io::asynch::Write; 20use embedded_io::asynch::Write;
21use rand::RngCore; 21use rand::RngCore;
@@ -26,7 +26,7 @@ use {defmt_rtt as _, panic_probe as _};
26async fn ethernet_task( 26async 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;
17use embassy_rp::gpio::{Input, Level, Output, Pull}; 17use embassy_rp::gpio::{Input, Level, Output, Pull};
18use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; 18use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0};
19use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; 19use embassy_rp::spi::{Async, Config as SpiConfig, Spi};
20use embassy_time::{Duration, Timer}; 20use embassy_time::{Delay, Duration, Timer};
21use embedded_hal_async::spi::ExclusiveDevice; 21use embedded_hal_async::spi::ExclusiveDevice;
22use embedded_io::asynch::Write; 22use embedded_io::asynch::Write;
23use rand::RngCore; 23use rand::RngCore;
@@ -28,7 +28,7 @@ use {defmt_rtt as _, panic_probe as _};
28async fn ethernet_task( 28async 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;
16use embassy_rp::gpio::{Input, Level, Output, Pull}; 16use embassy_rp::gpio::{Input, Level, Output, Pull};
17use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; 17use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0};
18use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; 18use embassy_rp::spi::{Async, Config as SpiConfig, Spi};
19use embassy_time::Duration; 19use embassy_time::{Delay, Duration};
20use embedded_hal_async::spi::ExclusiveDevice; 20use embedded_hal_async::spi::ExclusiveDevice;
21use embedded_io::asynch::Write; 21use embedded_io::asynch::Write;
22use rand::RngCore; 22use rand::RngCore;
@@ -26,7 +26,7 @@ use {defmt_rtt as _, panic_probe as _};
26async fn ethernet_task( 26async 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;
16use embassy_rp::gpio::{Input, Level, Output, Pull}; 16use embassy_rp::gpio::{Input, Level, Output, Pull};
17use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0}; 17use embassy_rp::peripherals::{PIN_17, PIN_20, PIN_21, SPI0};
18use embassy_rp::spi::{Async, Config as SpiConfig, Spi}; 18use embassy_rp::spi::{Async, Config as SpiConfig, Spi};
19use embassy_time::Delay;
19use embedded_hal_async::spi::ExclusiveDevice; 20use embedded_hal_async::spi::ExclusiveDevice;
20use rand::RngCore; 21use rand::RngCore;
21use static_cell::make_static; 22use static_cell::make_static;
@@ -24,7 +25,7 @@ use {defmt_rtt as _, panic_probe as _};
24async fn ethernet_task( 25async 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 {
175mod my_display_interface { 175mod 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) => {