aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-09-02 00:49:17 +0200
committerGitHub <[email protected]>2023-09-02 00:49:17 +0200
commit9d8c527308522698bfb6596bdb67bec826e0fb5a (patch)
tree75945e84157e272e3ba1fd69c0aa1d3f739b6999 /examples
parent1d87ec9cc36442542814d6dca7ae8e71068820e1 (diff)
parent1db00f54399307e4ec922965f5ca49547ccd14a3 (diff)
Merge pull request #1831 from vDorst/adin1110-part2
embassy-net-adin1110 more improvements
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32l4/Cargo.toml4
-rw-r--r--examples/stm32l4/src/bin/spe_adin1110_http_server.rs24
2 files changed, 20 insertions, 8 deletions
diff --git a/examples/stm32l4/Cargo.toml b/examples/stm32l4/Cargo.toml
index 5fe1499e6..92337e712 100644
--- a/examples/stm32l4/Cargo.toml
+++ b/examples/stm32l4/Cargo.toml
@@ -1,7 +1,7 @@
1[package] 1[package]
2edition = "2021" 2edition = "2021"
3name = "embassy-stm32l4-examples" 3name = "embassy-stm32l4-examples"
4version = "0.1.0" 4version = "0.1.1"
5license = "MIT OR Apache-2.0" 5license = "MIT OR Apache-2.0"
6 6
7[dependencies] 7[dependencies]
@@ -12,7 +12,7 @@ embassy-executor = { version = "0.3.0", path = "../../embassy-executor", feature
12embassy-time = { version = "0.1.3", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768", "unstable-traits", "nightly"] } 12embassy-time = { version = "0.1.3", path = "../../embassy-time", features = ["defmt", "defmt-timestamp-uptime", "tick-hz-32_768", "unstable-traits", "nightly"] }
13embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal" } 13embassy-embedded-hal = { version = "0.1.0", path = "../../embassy-embedded-hal" }
14embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] } 14embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"] }
15embassy-net-adin1110 = { version = "0.1.0", path = "../../embassy-net-adin1110", default-features = false } 15embassy-net-adin1110 = { version = "0.2.0", path = "../../embassy-net-adin1110" }
16embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "udp", "tcp", "dhcpv4", "medium-ethernet"] } 16embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "nightly", "udp", "tcp", "dhcpv4", "medium-ethernet"] }
17embassy-futures = { version = "0.1.0", path = "../../embassy-futures" } 17embassy-futures = { version = "0.1.0", path = "../../embassy-futures" }
18embedded-io-async = { version = "0.5.0", features = ["defmt-03"] } 18embedded-io-async = { version = "0.5.0", features = ["defmt-03"] }
diff --git a/examples/stm32l4/src/bin/spe_adin1110_http_server.rs b/examples/stm32l4/src/bin/spe_adin1110_http_server.rs
index 0a677be76..287521582 100644
--- a/examples/stm32l4/src/bin/spe_adin1110_http_server.rs
+++ b/examples/stm32l4/src/bin/spe_adin1110_http_server.rs
@@ -11,7 +11,9 @@
11// Settings switch S201 "HW CFG": 11// Settings switch S201 "HW CFG":
12// - Without SPI CRC: OFF-ON-OFF-OFF-OFF 12// - Without SPI CRC: OFF-ON-OFF-OFF-OFF
13// - With SPI CRC: ON -ON-OFF-OFF-OFF 13// - With SPI CRC: ON -ON-OFF-OFF-OFF
14// Settings switch S303 "uC CFG": CFG0: On = static ip, Off = Dhcp 14// Settings switch S303 "uC CFG":
15// - CFG0: On = static ip, Off = Dhcp
16// - CFG1: Ethernet `FCS` on TX path: On, Off
15// The webserver shows the actual temperature of the onboard i2c temp sensor. 17// The webserver shows the actual temperature of the onboard i2c temp sensor.
16 18
17use core::marker::PhantomData; 19use core::marker::PhantomData;
@@ -107,7 +109,7 @@ async fn main(spawner: Spawner) {
107 109
108 // Read the uc_cfg switches 110 // Read the uc_cfg switches
109 let uc_cfg0 = Input::new(dp.PB2, Pull::None); 111 let uc_cfg0 = Input::new(dp.PB2, Pull::None);
110 let _uc_cfg1 = Input::new(dp.PF11, Pull::None); 112 let uc_cfg1 = Input::new(dp.PF11, Pull::None);
111 let _uc_cfg2 = Input::new(dp.PG6, Pull::None); 113 let _uc_cfg2 = Input::new(dp.PG6, Pull::None);
112 let _uc_cfg3 = Input::new(dp.PG11, Pull::None); 114 let _uc_cfg3 = Input::new(dp.PG11, Pull::None);
113 115
@@ -154,11 +156,13 @@ async fn main(spawner: Spawner) {
154 156
155 let cfg0_without_crc = spe_cfg0.is_high(); 157 let cfg0_without_crc = spe_cfg0.is_high();
156 let cfg1_spi_mode = spe_cfg1.is_high(); 158 let cfg1_spi_mode = spe_cfg1.is_high();
159 let uc_cfg1_fcs_en = uc_cfg1.is_low();
157 160
158 defmt::println!( 161 defmt::println!(
159 "ADIN1110: CFG SPI-MODE 1-{}, CRC-bit 0-{}", 162 "ADIN1110: CFG SPI-MODE 1-{}, CRC-bit 0-{} FCS-{}",
160 cfg1_spi_mode, 163 cfg1_spi_mode,
161 cfg0_without_crc 164 cfg0_without_crc,
165 uc_cfg1_fcs_en
162 ); 166 );
163 167
164 // Check the SPI mode selected with the "HW CFG" dip-switch 168 // Check the SPI mode selected with the "HW CFG" dip-switch
@@ -172,8 +176,16 @@ async fn main(spawner: Spawner) {
172 176
173 let state = make_static!(embassy_net_adin1110::State::<8, 8>::new()); 177 let state = make_static!(embassy_net_adin1110::State::<8, 8>::new());
174 178
175 let (device, runner) = 179 let (device, runner) = embassy_net_adin1110::new(
176 embassy_net_adin1110::new(MAC, state, spe_spi, spe_int, spe_reset_n, !cfg0_without_crc).await; 180 MAC,
181 state,
182 spe_spi,
183 spe_int,
184 spe_reset_n,
185 !cfg0_without_crc,
186 uc_cfg1_fcs_en,
187 )
188 .await;
177 189
178 // Start task blink_led 190 // Start task blink_led
179 unwrap!(spawner.spawn(heartbeat_led(led_uc3_yellow))); 191 unwrap!(spawner.spawn(heartbeat_led(led_uc3_yellow)));