Skip to content

Commit 3eb5f92

Browse files
committed
Fix pin_impls in smi
1 parent 7e4e8bf commit 3eb5f92

File tree

3 files changed

+31
-18
lines changed

3 files changed

+31
-18
lines changed

Cargo.toml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ travis-ci = { repository = "astro/stm32-eth", branch = "master" }
1515
maintenance = { status = "experimental" }
1616

1717
[package.metadata.docs.rs]
18-
features = [ "smi", "smoltcp-phy", "stm32f429", "smoltcp/socket-tcp" ]
18+
features = ["smi", "smoltcp-phy", "stm32f429", "smoltcp/socket-tcp"]
1919

2020
[dependencies]
2121
volatile-register = "0.2.1"
@@ -24,7 +24,7 @@ stm32f7xx-hal = { git = "https://github.com/stm32-rs/stm32f7xx-hal", rev = "7099
2424
stm32f4xx-hal = { version = "0.12.0", optional = true }
2525
stm32f1xx-hal = { version = "0.9.0", optional = true }
2626
cortex-m = "0.7.4"
27-
log = { version = "0.4.14", optional = true }
27+
log = { version = "0.4.15", optional = true }
2828

2929
[dependencies.smoltcp]
3030
version = "0.8.0"
@@ -66,7 +66,7 @@ cortex-m-rt = "0.7.1"
6666
panic-itm = "0.4.2"
6767
cortex-m-semihosting = "0.3.7"
6868
stm32f4xx-hal = { version = "0.12.0", features = ["rt"] }
69-
stm32f1xx-hal = { version = "0.9.0", features = ["rt"] }
69+
# stm32f1xx-hal = { version = "0.9.0", features = ["rt"] }
7070

7171
[[example]]
7272
name = "pktgen"
@@ -79,9 +79,10 @@ required-features = [
7979
"smoltcp/log", "smoltcp/verbose"
8080
]
8181

82-
[[example]]
83-
name = "ip-f107"
84-
required-features = ["stm32f107", "smoltcp-phy", "log", "smoltcp/socket-tcp"]
82+
# [[example]]
83+
# name = "ip-f107"
84+
# required-features = ["stm32f107", "smi", "smoltcp-phy", "smoltcp/socket-tcp"]
85+
8586
[[example]]
8687
name = "arp"
8788
required-features = ["stm32f407", "smi"]

src/smi.rs

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
#[cfg(feature = "stm32f4xx-hal")]
2-
use stm32f4xx_hal::stm32;
3-
#[cfg(feature = "stm32f7xx-hal")]
4-
use stm32f7xx_hal::pac as stm32;
1+
use crate::stm32;
52

63
use stm32::ethernet_mac::{MACMIIAR, MACMIIDR};
74

@@ -107,15 +104,30 @@ where
107104
}
108105
}
109106

110-
#[cfg(feature = "device-selected")]
107+
#[cfg(feature = "stm32f4xx-hal")]
108+
mod pin_impls {
109+
use crate::hal::gpio::{gpioa::PA2, gpioc::PC1, Alternate, PushPull};
110+
111+
const AF11: u8 = 11;
112+
113+
unsafe impl super::MdioPin for PA2<Alternate<PushPull, AF11>> {}
114+
unsafe impl super::MdcPin for PC1<Alternate<PushPull, AF11>> {}
115+
}
116+
117+
#[cfg(feature = "stm32f7xx-hal")]
111118
mod pin_impls {
112-
#[cfg(feature = "stm32f4xx-hal")]
113-
use stm32f4xx_hal::gpio::{gpioa::PA2, gpioc::PC1, Alternate, AF11};
114-
#[cfg(feature = "stm32f1xx-hal")]
115-
use stm32f7xx_hal::gpio::{gpioa::PA2, gpioc::PC1, Alternate, AF11};
116-
#[cfg(feature = "stm32f7xx-hal")]
117-
use stm32f7xx_hal::gpio::{gpioa::PA2, gpioc::PC1, Alternate, AF11};
119+
use crate::hal::gpio::{gpioa::PA2, gpioc::PC1, Alternate};
120+
121+
const AF11: u8 = 11;
118122

119123
unsafe impl super::MdioPin for PA2<Alternate<AF11>> {}
120124
unsafe impl super::MdcPin for PC1<Alternate<AF11>> {}
121125
}
126+
127+
#[cfg(feature = "stm32f1xx-hal")]
128+
mod pin_impls {
129+
use crate::hal::gpio::{gpioa::PA2, gpioc::PC1, Alternate, PushPull};
130+
131+
unsafe impl super::MdioPin for PA2<Alternate<PushPull>> {}
132+
unsafe impl super::MdcPin for PC1<Alternate<PushPull>> {}
133+
}

src/tx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ impl<'a> TxRing<'a> {
263263

264264
/// Is the Tx DMA engine running?
265265
pub fn is_running(&self, eth_dma: &ETHERNET_DMA) -> bool {
266-
self.running_state(&eth_dma).is_running()
266+
self.running_state(eth_dma).is_running()
267267
}
268268

269269
fn running_state(&self, eth_dma: &ETHERNET_DMA) -> RunningState {

0 commit comments

Comments
 (0)