Skip to content

Commit c79b688

Browse files
committed
ff
1 parent 46915cf commit c79b688

File tree

7 files changed

+144
-213
lines changed

7 files changed

+144
-213
lines changed

Cargo.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ stm32f479 = ["svd-f469", "cryp"]
166166

167167
svd-f401 = ["f4", "stm32f4?/stm32f401", "gpio-f401"]
168168
svd-f405 = ["f4", "stm32f4?/stm32f405", "gpio-f417"]
169-
svd-f407 = ["f4", "stm32f4?/stm32f407", "gpio-f417"]
169+
svd-f407 = ["f4", "stm32f4?/stm32f407", "gpio-f417", "eth"]
170170
svd-f410 = ["f4", "stm32f4?/stm32f410", "gpio-f410"]
171171
svd-f411 = ["f4", "stm32f4?/stm32f411", "gpio-f411"]
172172
svd-f412 = ["f4", "stm32f4?/stm32f412", "gpio-f412"]
@@ -399,7 +399,6 @@ gpio-f417 = [
399399
"can2",
400400
"dac",
401401
"dcmi",
402-
"eth",
403402
"fsmc",
404403
"i2c2",
405404
"i2c3",
@@ -720,6 +719,7 @@ gpio-f72x = [
720719
"i2s3",
721720
"lptim1",
722721
"quadspi",
722+
"rng",
723723
"rtc",
724724
"sai1",
725725
"sai2",
@@ -786,6 +786,7 @@ gpio-f746 = [
786786
"lptim1",
787787
"ltdc",
788788
"quadspi",
789+
"rng",
789790
"rtc",
790791
"sai1",
791792
"sai2",
@@ -853,6 +854,7 @@ gpio-f76x = [
853854
"lptim1",
854855
"ltdc",
855856
"quadspi",
857+
"rng",
856858
"rtc",
857859
"sai1",
858860
"sai2",

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@ pub mod otg_fs;
136136
#[cfg(all(any(feature = "usb_hs", docsrs), feature = "otg-hs"))]
137137
pub mod otg_hs;
138138

139-
#[cfg(feature = "f4")]
140139
#[cfg(feature = "rng")]
141140
pub mod rng;
142141

src/rcc/enable.rs

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
use super::*;
2+
3+
bus! {
4+
GPIOA => (AHB1, 0, gpioaen, gpioalpen, gpioarst),
5+
GPIOB => (AHB1, 1, gpioben, gpioblpen, gpiobrst),
6+
}
7+
#[cfg(feature = "gpioc")]
8+
bus! { GPIOC => (AHB1, 2, gpiocen, gpioclpen, gpiocrst),}
9+
#[cfg(feature = "gpiod")]
10+
bus! { GPIOD => (AHB1, 3, gpioden, gpiodlpen, gpiodrst),}
11+
#[cfg(feature = "gpioe")]
12+
bus! { GPIOE => (AHB1, 4, gpioeen, gpioelpen, gpioerst),}
13+
#[cfg(feature = "gpiof")]
14+
bus! { GPIOF => (AHB1, 5, gpiofen, gpioflpen, gpiofrst),}
15+
#[cfg(feature = "gpiog")]
16+
bus! { GPIOG => (AHB1, 6, gpiogen, gpioglpen, gpiogrst),}
17+
#[cfg(feature = "gpioh")]
18+
bus! { GPIOH => (AHB1, 7, gpiohen, gpiohlpen, gpiohrst),}
19+
#[cfg(feature = "gpioi")]
20+
bus! { GPIOI => (AHB1, 8, gpioien, gpioilpen, gpioirst),}
21+
#[cfg(feature = "gpioj")]
22+
bus! { GPIOJ => (AHB1, 9, gpiojen, gpiojlpen, gpiojrst),}
23+
#[cfg(feature = "gpiok")]
24+
bus! { GPIOK => (AHB1, 10, gpioken, gpioklpen, gpiokrst),}
25+
26+
bus! {
27+
CRC => (AHB1, 12, crcen, crclpen, crcrst),
28+
DMA1 => (AHB1, 21, dma1en, dma1lpen, dma1rst),
29+
DMA2 => (AHB1, 22, dma2en, dma2lpen, dma2rst),
30+
}
31+
32+
#[cfg(feature = "dma2d")]
33+
bus! { DMA2D => (AHB1, 23, dma2den, dma2dlpen, dma2drst),}
34+
35+
#[cfg(feature = "eth")]
36+
bus! { ETHERNET_MAC => (AHB1, 25, ethmacen, ethmaclpen, ethmacrst),}
37+
38+
#[cfg(feature = "otg-hs")]
39+
bus! { OTG_HS_GLOBAL => (AHB1, 29, otghsen, otghslpen, otghsrst),}
40+
41+
#[cfg(feature = "rng")]
42+
bus! { RNG => (AHB2, 6, rngen, rnglpen, rngrst),}
43+
44+
#[cfg(feature = "otg-fs")]
45+
bus! { OTG_FS_GLOBAL => (AHB2, 7, otgfsen, otgfslpen, otgfsrst),}
46+
47+
#[cfg(feature = "fmc")]
48+
bus! { FMC => (AHB3, 0, fmcen, fmclpen, fmcrst),}
49+
50+
#[cfg(feature = "fsmc")]
51+
#[cfg(feature = "svd-f427")]
52+
bus! { FSMC => (AHB3, 0, fmcen, fmclpen, fmcrst),}
53+
54+
#[cfg(feature = "fsmc")]
55+
#[cfg(not(feature = "svd-f427"))]
56+
bus! { FSMC => (AHB3, 0, fsmcen, fsmclpen, fsmcrst),}
57+
58+
#[cfg(feature = "quadspi")]
59+
bus! {
60+
QUADSPI => (AHB3, 1, qspien, , qspirst),
61+
}
62+
63+
#[cfg(feature = "tim2")]
64+
bus! { TIM2 => (APB1, 0, tim2en, tim2lpen, tim2rst),}
65+
#[cfg(feature = "tim3")]
66+
bus! { TIM3 => (APB1, 1, tim3en, tim3lpen, tim3rst),}
67+
#[cfg(feature = "tim4")]
68+
bus! { TIM4 => (APB1, 2, tim4en, tim4lpen, tim4rst),}
69+
#[cfg(feature = "tim5")]
70+
bus! { TIM5 => (APB1, 3, tim5en, tim5lpen, tim5rst),}
71+
#[cfg(feature = "tim6")]
72+
bus! { TIM6 => (APB1, 4, tim6en, tim6lpen, tim6rst),}
73+
#[cfg(feature = "tim7")]
74+
bus! { TIM7 => (APB1, 5, tim7en, tim7lpen, tim7rst),}
75+
#[cfg(feature = "tim12")]
76+
bus! { TIM12 => (APB1, 6, tim12en, tim12lpen, tim12rst),}
77+
#[cfg(feature = "tim13")]
78+
bus! { TIM13 => (APB1, 7, tim13en, tim13lpen, tim13rst),}
79+
#[cfg(feature = "tim14")]
80+
bus! { TIM14 => (APB1, 8, tim14en, tim14lpen, tim14rst),}
81+
82+
#[cfg(feature = "lptim1")]
83+
#[cfg(not(feature = "svd-f413"))]
84+
bus! { LPTIM1 => (APB1, 9, lptim1en, lptim1lpen, lptim1rst),}
85+
#[cfg(feature = "lptim1")]
86+
#[cfg(feature = "svd-f413")]
87+
bus! { LPTIM => (APB1, 9, lptimer1en, lptimer1lpen, lptimer1rst),}
88+
89+
bus! { WWDG => (APB1, 11, wwdgen, wwdglpen, wwdgrst),}
90+
91+
#[cfg(feature = "spi2")]
92+
bus! { SPI2 => (APB1, 14, spi2en, spi2lpen, spi2rst),}
93+
#[cfg(feature = "spi3")]
94+
bus! { SPI3 => (APB1, 15, spi3en, spi3lpen, spi3rst),}
95+
96+
#[cfg(feature = "usart2")]
97+
bus! { USART2 => (APB1, 17, usart2en, usart2lpen, usart2rst),}
98+
#[cfg(feature = "usart3")]
99+
bus! { USART3 => (APB1, 18, usart3en, usart3lpen, usart3rst),}
100+
101+
#[cfg(feature = "uart4")]
102+
bus! { UART4 => (APB1, 19, uart4en, uart4lpen, uart4rst),}
103+
#[cfg(feature = "uart5")]
104+
bus! { UART5 => (APB1, 20, uart5en, uart5lpen, uart5rst),}

src/rcc/f4/enable.rs

Lines changed: 13 additions & 149 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,25 @@
11
use super::super::{bus, bus_enable, bus_lpenable, bus_reset};
22
use super::*;
33

4-
#[cfg(feature = "quadspi")]
5-
bus! {
6-
QUADSPI => (AHB3, 1, qspien, , qspirst),
7-
}
8-
9-
bus! {
10-
CRC => (AHB1, 12, crcen, crclpen, crcrst),
11-
DMA1 => (AHB1, 21, dma1en, dma1lpen, dma1rst),
12-
DMA2 => (AHB1, 22, dma2en, dma2lpen, dma2rst),
13-
}
14-
15-
bus! {
16-
GPIOA => (AHB1, 0, gpioaen, gpioalpen, gpioarst),
17-
GPIOB => (AHB1, 1, gpioben, gpioblpen, gpiobrst),
18-
}
19-
#[cfg(feature = "gpioc")]
20-
bus! { GPIOC => (AHB1, 2, gpiocen, gpioclpen, gpiocrst),}
21-
#[cfg(feature = "gpiod")]
22-
bus! { GPIOD => (AHB1, 3, gpioden, gpiodlpen, gpiodrst),}
23-
#[cfg(feature = "gpioe")]
24-
bus! { GPIOE => (AHB1, 4, gpioeen, gpioelpen, gpioerst),}
25-
#[cfg(feature = "gpiof")]
26-
bus! { GPIOF => (AHB1, 5, gpiofen, gpioflpen, gpiofrst),}
27-
#[cfg(feature = "gpiog")]
28-
bus! { GPIOG => (AHB1, 6, gpiogen, gpioglpen, gpiogrst),}
29-
#[cfg(feature = "gpioh")]
30-
bus! { GPIOH => (AHB1, 7, gpiohen, gpiohlpen, gpiohrst),}
31-
#[cfg(feature = "gpioi")]
32-
bus! { GPIOI => (AHB1, 8, gpioien, gpioilpen, gpioirst), }
33-
#[cfg(feature = "gpioj")]
34-
bus! { GPIOJ => (AHB1, 9, gpiojen, gpiojlpen, gpiojrst),}
35-
#[cfg(feature = "gpiok")]
36-
bus! { GPIOK => (AHB1, 10, gpioken, gpioklpen, gpiokrst),}
37-
38-
#[cfg(feature = "rng")]
39-
bus! { RNG => (AHB2, 6, rngen, rnglpen, rngrst), }
40-
41-
#[cfg(feature = "otg-fs")]
42-
bus! { OTG_FS_GLOBAL => (AHB2, 7, otgfsen, otgfslpen, otgfsrst), }
43-
44-
#[cfg(feature = "otg-hs")]
45-
bus! { OTG_HS_GLOBAL => (AHB1, 29, otghsen, otghslpen, otghsrst), }
46-
47-
#[cfg(feature = "fmc")]
48-
bus! { FMC => (AHB3, 0, fmcen, fmclpen, fmcrst), }
49-
50-
#[cfg(feature = "fsmc")]
51-
#[cfg(feature = "svd-f427")]
52-
bus! { FSMC => (AHB3, 0, fmcen, fmclpen, fmcrst), }
53-
54-
#[cfg(feature = "fsmc")]
55-
#[cfg(not(feature = "svd-f427"))]
56-
bus! { FSMC => (AHB3, 0, fsmcen, fsmclpen, fsmcrst), }
57-
58-
bus! { PWR => (APB1, 28, pwren, pwrlpen, pwrrst), }
59-
60-
bus! {
61-
SPI1 => (APB2, 12, spi1en, spi1lpen, spi1rst),
62-
SPI2 => (APB1, 14, spi2en, spi2lpen, spi2rst),
63-
}
64-
#[cfg(feature = "spi3")]
65-
bus! {
66-
SPI3 => (APB1, 15, spi3en, spi3lpen, spi3rst),
67-
}
4+
bus! { PWR => (APB1, 28, pwren, pwrlpen, pwrrst),}
685

6+
#[cfg(feature = "spi1")]
7+
bus! { SPI1 => (APB2, 12, spi1en, spi1lpen, spi1rst),}
698
#[cfg(feature = "spi4")]
70-
bus! {
71-
SPI4 => (APB2, 13, spi4en, spi4lpen, spi4rst),
72-
}
9+
bus! { SPI4 => (APB2, 13, spi4en, spi4lpen, spi4rst),}
7310

7411
#[cfg(feature = "spi5")]
75-
bus! {
76-
SPI5 => (APB2, 20, spi5en, spi5lpen, spi5rst),
77-
}
12+
bus! { SPI5 => (APB2, 20, spi5en, spi5lpen, spi5rst),}
7813

7914
#[cfg(feature = "spi6")]
80-
bus! {
81-
SPI6 => (APB2, 21, spi6en, spi6lpen, spi6rst),
82-
}
15+
bus! { SPI6 => (APB2, 21, spi6en, spi6lpen, spi6rst),}
8316

8417
bus! {
8518
I2C1 => (APB1, 21, i2c1en, i2c1lpen, i2c1rst),
8619
I2C2 => (APB1, 22, i2c2en, i2c2lpen, i2c2rst),
8720
}
8821
#[cfg(feature = "i2c3")]
89-
bus! {
90-
I2C3 => (APB1, 23, i2c3en, i2c3lpen, i2c3rst),
91-
}
22+
bus! { I2C3 => (APB1, 23, i2c3en, i2c3lpen, i2c3rst),}
9223
#[cfg(feature = "fmpi2c1")]
9324
#[cfg(not(feature = "svd-f412"))]
9425
bus! {
@@ -102,19 +33,8 @@ bus! {
10233

10334
bus! {
10435
USART1 => (APB2, 4, usart1en, usart1lpen, usart1rst),
105-
USART2 => (APB1, 17, usart2en, usart2lpen, usart2rst),
10636
USART6 => (APB2, 5, usart6en, usart6lpen, usart6rst),
10737
}
108-
#[cfg(feature = "usart3")]
109-
bus! {
110-
USART3 => (APB1, 18, usart3en, usart3lpen, usart3rst),
111-
}
112-
113-
#[cfg(any(feature = "uart4", feature = "uart5"))]
114-
bus! {
115-
UART4 => (APB1, 19, uart4en, uart4lpen, uart4rst),
116-
UART5 => (APB1, 20, uart5en, uart5lpen, uart5rst),
117-
}
11838

11939
#[cfg(any(feature = "uart7", feature = "uart8"))]
12040
bus! {
@@ -139,37 +59,21 @@ bus! {
13959
}
14060

14161
#[cfg(feature = "dac")]
142-
bus! {
143-
DAC => (APB1, 29, dacen, daclpen, dacrst),
144-
}
62+
bus! { DAC => (APB1, 29, dacen, daclpen, dacrst),}
14563

14664
bus! {
14765
SYSCFG => (APB2, 14, syscfgen, syscfglpen, syscfgrst),
14866
}
14967

150-
bus! {
151-
ADC1 => (APB2, 8, adc1en, adc1lpen, adcrst),
152-
}
68+
bus! { ADC1 => (APB2, 8, adc1en, adc1lpen, adcrst),}
15369

15470
#[cfg(feature = "adc2")]
155-
impl RccBus for crate::pac::ADC2 {
156-
type Bus = APB2;
157-
}
158-
#[cfg(feature = "adc2")]
159-
bus_enable!(ADC2 => 9, adc2en);
160-
#[cfg(feature = "adc2")]
161-
bus_lpenable!(ADC2 => 9, adc2lpen);
71+
bus! { ADC2 => (APB2, 9, adc2en, adc2lpen, ),}
16272
#[cfg(feature = "adc2")]
16373
bus_reset!(ADC2 => 8, adcrst);
16474

16575
#[cfg(feature = "adc3")]
166-
impl RccBus for crate::pac::ADC3 {
167-
type Bus = APB2;
168-
}
169-
#[cfg(feature = "adc3")]
170-
bus_enable!(ADC3 => 10, adc3en);
171-
#[cfg(feature = "adc3")]
172-
bus_lpenable!(ADC3 => 10, adc3lpen);
76+
bus! { ADC3 => (APB2, 10, adc3en, adc3lpen, ),}
17377
#[cfg(feature = "adc3")]
17478
bus_reset!(ADC3 => 8, adcrst);
17579

@@ -200,61 +104,21 @@ bus! {
200104

201105
bus! {
202106
TIM1 => (APB2, 0, tim1en, tim1lpen, tim1rst),
203-
TIM5 => (APB1, 3, tim5en, tim5lpen, tim5rst),
204107
TIM9 => (APB2, 16, tim9en, tim9lpen, tim9rst),
205108
TIM11 => (APB2, 18, tim11en, tim11lpen, tim11rst),
206109
}
207110

208-
#[cfg(any(
209-
feature = "gpio-f401",
210-
feature = "gpio-f417",
211-
feature = "gpio-f411",
212-
feature = "gpio-f412",
213-
feature = "gpio-f413",
214-
feature = "gpio-f427",
215-
feature = "gpio-f446",
216-
feature = "gpio-f469",
217-
))]
218-
bus! {
219-
TIM2 => (APB1, 0, tim2en, tim2lpen, tim2rst),
220-
TIM3 => (APB1, 1, tim3en, tim3lpen, tim3rst),
221-
TIM4 => (APB1, 2, tim4en, tim4lpen, tim4rst),
222-
TIM10 => (APB2, 17, tim10en, tim10lpen, tim10rst),
223-
}
111+
#[cfg(feature = "tim10")]
112+
bus! { TIM10 => (APB2, 17, tim10en, tim10lpen, tim10rst),}
224113

225-
#[cfg(feature = "tim6")]
226-
bus! {
227-
TIM6 => (APB1, 4, tim6en, tim6lpen, tim6rst),
228-
}
229-
#[cfg(feature = "tim7")]
230-
bus! {
231-
TIM7 => (APB1, 5, tim7en, tim7lpen, tim7rst),
232-
}
233114
#[cfg(feature = "tim8")]
234115
bus! {
235116
TIM8 => (APB2, 1, tim8en, tim8lpen, tim8rst),
236117
}
237-
#[cfg(feature = "tim12")]
238-
bus! {
239-
TIM12 => (APB1, 6, tim12en, tim12lpen, tim12rst),
240-
}
241-
#[cfg(feature = "tim13")]
242-
bus! {
243-
TIM13 => (APB1, 7, tim13en, tim13lpen, tim13rst),
244-
}
245-
#[cfg(feature = "tim14")]
246-
bus! {
247-
TIM14 => (APB1, 8, tim14en, tim14lpen, tim14rst),
248-
}
249-
250118
#[cfg(feature = "ltdc")]
251119
bus! {
252120
LTDC => (APB2, 26, ltdcen, ltdclpen, ltdcrst),
253121
}
254-
#[cfg(feature = "dma2d")]
255-
bus! {
256-
DMA2D => (AHB1, 23, dma2den, dma2dlpen, dma2drst),
257-
}
258122
#[cfg(feature = "dsihost")]
259123
bus! {
260124
DSI => (APB2, 27, dsien, dsilpen, dsirst),

0 commit comments

Comments
 (0)