aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorRenĂ© van Dorst <[email protected]>2023-08-27 13:47:02 +0200
committerRenĂ© van Dorst <[email protected]>2023-08-28 00:28:45 +0200
commit2c36199dea8230f261bc1ee210f96f47272b8b11 (patch)
treefa3276a2a7bbac7079bb64bb9160f93180a5b206 /examples
parent13a0be628937125042a961175861bbdba6dcab34 (diff)
stm32l4: Update adin1110 example add FCS option
Diffstat (limited to 'examples')
-rw-r--r--examples/stm32l4/src/bin/spe_adin1110_http_server.rs24
1 files changed, 18 insertions, 6 deletions
diff --git a/examples/stm32l4/src/bin/spe_adin1110_http_server.rs b/examples/stm32l4/src/bin/spe_adin1110_http_server.rs
index 148c58771..baaa9dfad 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)));