aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32h7/src/bin
diff options
context:
space:
mode:
authorDavid Lenfesty <[email protected]>2022-04-25 19:57:09 -0600
committerDario Nieuwenhuis <[email protected]>2022-04-30 04:49:24 +0200
commit2e7b42fc5b62f134bc1c477e4817e0c512c399b3 (patch)
tree2243583283e74d58a3aac3e4c1128aa9cecf925e /examples/stm32h7/src/bin
parent905b40e212e794895824906cffaf9df9b9900dd3 (diff)
embassy-stm32/eth: convert LAN8742 driver to generic SMI driver
SMI Ethernet PHYs all share a common base set of registers that can do 90% of all tasks. The LAN8742 driver used some vendor-specific registers to check link negotiation status, but the need for that was debatable, so I migrated it to a generic driver instead, anybody who wants extra functionality can copy it and impl their own on top of it.
Diffstat (limited to 'examples/stm32h7/src/bin')
-rw-r--r--examples/stm32h7/src/bin/eth.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/stm32h7/src/bin/eth.rs b/examples/stm32h7/src/bin/eth.rs
index 4eb5421a8..9a2e7a33d 100644
--- a/examples/stm32h7/src/bin/eth.rs
+++ b/examples/stm32h7/src/bin/eth.rs
@@ -14,7 +14,7 @@ use embassy::util::Forever;
14use embassy_net::{ 14use embassy_net::{
15 Config as NetConfig, Ipv4Address, Ipv4Cidr, StackResources, StaticConfigurator, TcpSocket, 15 Config as NetConfig, Ipv4Address, Ipv4Cidr, StackResources, StaticConfigurator, TcpSocket,
16}; 16};
17use embassy_stm32::eth::lan8742a::LAN8742A; 17use embassy_stm32::eth::generic_smi::GenericSMI;
18use embassy_stm32::eth::{Ethernet, State}; 18use embassy_stm32::eth::{Ethernet, State};
19use embassy_stm32::interrupt; 19use embassy_stm32::interrupt;
20use embassy_stm32::peripherals::ETH; 20use embassy_stm32::peripherals::ETH;
@@ -26,7 +26,7 @@ use heapless::Vec;
26 26
27#[embassy::task] 27#[embassy::task]
28async fn main_task( 28async fn main_task(
29 device: &'static mut Ethernet<'static, ETH, LAN8742A, 4, 4>, 29 device: &'static mut Ethernet<'static, ETH, GenericSMI, 4, 4>,
30 config: &'static mut StaticConfigurator, 30 config: &'static mut StaticConfigurator,
31 spawner: Spawner, 31 spawner: Spawner,
32) { 32) {
@@ -82,7 +82,7 @@ static mut RNG_INST: Option<Rng<RNG>> = None;
82 82
83static EXECUTOR: Forever<Executor> = Forever::new(); 83static EXECUTOR: Forever<Executor> = Forever::new();
84static STATE: Forever<State<'static, ETH, 4, 4>> = Forever::new(); 84static STATE: Forever<State<'static, ETH, 4, 4>> = Forever::new();
85static ETH: Forever<Ethernet<'static, ETH, LAN8742A, 4, 4>> = Forever::new(); 85static ETH: Forever<Ethernet<'static, ETH, GenericSMI, 4, 4>> = Forever::new();
86static CONFIG: Forever<StaticConfigurator> = Forever::new(); 86static CONFIG: Forever<StaticConfigurator> = Forever::new();
87static NET_RESOURCES: Forever<StackResources<1, 2, 8>> = Forever::new(); 87static NET_RESOURCES: Forever<StackResources<1, 2, 8>> = Forever::new();
88 88
@@ -114,7 +114,7 @@ fn main() -> ! {
114 let eth = unsafe { 114 let eth = unsafe {
115 ETH.put(Ethernet::new( 115 ETH.put(Ethernet::new(
116 state, p.ETH, eth_int, p.PA1, p.PA2, p.PC1, p.PA7, p.PC4, p.PC5, p.PG13, p.PB13, 116 state, p.ETH, eth_int, p.PA1, p.PA2, p.PC1, p.PA7, p.PC4, p.PC5, p.PG13, p.PB13,
117 p.PG11, LAN8742A, mac_addr, 0, 117 p.PG11, GenericSMI, mac_addr, 0,
118 )) 118 ))
119 }; 119 };
120 120