@@ -24,22 +24,44 @@ pub use stm32f1xx_hal as hal;
24
24
#[ cfg( feature = "stm32f1xx-hal" ) ]
25
25
pub use stm32f1xx_hal:: pac as stm32;
26
26
27
- use hal:: rcc:: Clocks ;
28
- use stm32:: { ETHERNET_DMA , ETHERNET_MAC , ETHERNET_MMC } ;
27
+ #[ cfg( feature = "device-selected" ) ]
28
+ use {
29
+ hal:: rcc:: Clocks ,
30
+ stm32:: { ETHERNET_DMA , ETHERNET_MAC , ETHERNET_MMC } ,
31
+ } ;
29
32
33
+ #[ cfg( feature = "device-selected" ) ]
30
34
mod dma;
35
+ #[ cfg( feature = "device-selected" ) ]
31
36
pub use dma:: { eth_interrupt_handler, EthernetDMA } ;
37
+
38
+ #[ cfg( feature = "device-selected" ) ]
32
39
mod ring;
40
+ #[ cfg( feature = "device-selected" ) ]
33
41
pub use ring:: RingEntry ;
42
+
34
43
mod desc;
44
+
45
+ #[ cfg( feature = "device-selected" ) ]
35
46
pub mod mac;
47
+ #[ cfg( feature = "device-selected" ) ]
36
48
pub use mac:: { EthernetMAC , EthernetMACWithMii , WrongClock } ;
49
+
50
+ #[ cfg( feature = "device-selected" ) ]
37
51
mod rx;
52
+ #[ cfg( feature = "device-selected" ) ]
38
53
pub use rx:: { RxDescriptor , RxError , RxRingEntry } ;
54
+
55
+ #[ cfg( feature = "device-selected" ) ]
39
56
mod tx;
57
+ #[ cfg( feature = "device-selected" ) ]
40
58
pub use tx:: { TxDescriptor , TxError , TxRingEntry } ;
59
+
60
+ #[ cfg( feature = "device-selected" ) ]
41
61
pub mod setup;
62
+ #[ cfg( feature = "device-selected" ) ]
42
63
pub use setup:: EthPins ;
64
+ #[ cfg( feature = "device-selected" ) ]
43
65
use setup:: {
44
66
AlternateVeryHighSpeed , RmiiCrsDv , RmiiRefClk , RmiiRxD0 , RmiiRxD1 , RmiiTxD0 , RmiiTxD1 , RmiiTxEN ,
45
67
} ;
@@ -51,6 +73,9 @@ mod smoltcp_phy;
51
73
#[ cfg( feature = "smoltcp-phy" ) ]
52
74
pub use smoltcp_phy:: { EthRxToken , EthTxToken } ;
53
75
76
+ #[ cfg( not( feature = "device-selected" ) ) ]
77
+ compile_error ! ( "No device was selected! Exactly one stm32fxxx feature must be selected." ) ;
78
+
54
79
/// From the datasheet: *VLAN Frame maxsize = 1522*
55
80
const MTU : usize = 1522 ;
56
81
@@ -62,13 +87,14 @@ const MTU: usize = 1522;
62
87
/// Automatically sets slew rate to VeryHigh.
63
88
///
64
89
/// This method does not initialise the external PHY. Interacting with a PHY
65
- /// can be done by using the struct returned from [`EthernetMAC::smi `].
90
+ /// can be done by using the struct returned from [`EthernetMAC::mii `].
66
91
///
67
92
/// /// # Note
68
93
/// - Make sure that the buffers reside in a memory region that is
69
94
/// accessible by the peripheral. Core-Coupled Memory (CCM) is
70
95
/// usually not accessible.
71
96
/// - HCLK must be at least 25 MHz.
97
+ #[ cfg( feature = "device-selected" ) ]
72
98
pub fn new < ' rx , ' tx , REFCLK , CRS , TXEN , TXD0 , TXD1 , RXD0 , RXD1 > (
73
99
eth_mac : ETHERNET_MAC ,
74
100
eth_mmc : ETHERNET_MMC ,
@@ -113,6 +139,7 @@ where
113
139
/// accessible by the peripheral. Core-Coupled Memory (CCM) is
114
140
/// usually not accessible.
115
141
/// - HCLK must be at least 25 MHz.
142
+ #[ cfg( feature = "device-selected" ) ]
116
143
pub fn new_with_mii < ' rx , ' tx , REFCLK , CRS , TXEN , TXD0 , TXD1 , RXD0 , RXD1 , MDIO , MDC > (
117
144
eth_mac : ETHERNET_MAC ,
118
145
eth_mmc : ETHERNET_MMC ,
0 commit comments