Skip to content

Commit 6ec9c36

Browse files
committed
add support for pins D4-D7 and 8-wide data bus
1 parent 157b06d commit 6ec9c36

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

src/sdio.rs

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,31 @@ pub trait PinD0 {}
1616
pub trait PinD1 {}
1717
pub trait PinD2 {}
1818
pub trait PinD3 {}
19+
pub trait PinD4 {}
20+
pub trait PinD5 {}
21+
pub trait PinD6 {}
22+
pub trait PinD7 {}
1923

2024
pub trait Pins {
2125
const BUSWIDTH: Buswidth;
2226
}
2327

28+
impl<CLK, CMD, D0, D1, D2, D3, D4, D5, D6, D7> Pins for (CLK, CMD, D0, D1, D2, D3, D4, D5, D6, D7)
29+
where
30+
CLK: PinClk,
31+
CMD: PinCmd,
32+
D0: PinD0,
33+
D1: PinD1,
34+
D2: PinD2,
35+
D3: PinD3,
36+
D4: PinD4,
37+
D5: PinD5,
38+
D6: PinD6,
39+
D7: PinD7,
40+
{
41+
const BUSWIDTH: Buswidth = Buswidth::Buswidth8;
42+
}
43+
2444
impl<CLK, CMD, D0, D1, D2, D3> Pins for (CLK, CMD, D0, D1, D2, D3)
2545
where
2646
CLK: PinClk,
@@ -43,7 +63,7 @@ where
4363
}
4464

4565
macro_rules! pins {
46-
($(CLK: [$($CLK:ty),*] CMD: [$($CMD:ty),*] D0: [$($D0:ty),*] D1: [$($D1:ty),*] D2: [$($D2:ty),*] D3: [$($D3:ty),*])+) => {
66+
($(CLK: [$($CLK:ty),*] CMD: [$($CMD:ty),*] D0: [$($D0:ty),*] D1: [$($D1:ty),*] D2: [$($D2:ty),*] D3: [$($D3:ty),*] D4: [$($D4:ty),*] D5: [$($D5:ty),*] D6: [$($D6:ty),*] D7: [$($D7:ty),*])+) => {
4767
$(
4868
$(
4969
impl PinClk for $CLK {}
@@ -63,6 +83,18 @@ macro_rules! pins {
6383
$(
6484
impl PinD3 for $D3 {}
6585
)*
86+
$(
87+
impl PinD4 for $D4 {}
88+
)*
89+
$(
90+
impl PinD5 for $D5 {}
91+
)*
92+
$(
93+
impl PinD6 for $D6 {}
94+
)*
95+
$(
96+
impl PinD7 for $D7 {}
97+
)*
6698
)+
6799
}
68100
}
@@ -92,6 +124,10 @@ pins! {
92124
D1: [gpio::PC9<Alternate<PushPull, 12>>]
93125
D2: [gpio::PC10<Alternate<PushPull, 12>>]
94126
D3: [gpio::PC11<Alternate<PushPull, 12>>]
127+
D4: [gpio::PB8<Alternate<PushPull, 12>>]
128+
D5: [gpio::PB9<Alternate<PushPull, 12>>]
129+
D6: [gpio::PC6<Alternate<PushPull, 12>>]
130+
D7: [gpio::PC7<Alternate<PushPull, 12>>]
95131
}
96132

97133
#[cfg(any(feature = "stm32f412", feature = "stm32f413", feature = "stm32f423"))]
@@ -102,6 +138,10 @@ pins! {
102138
D1: [gpio::PA8<Alternate<PushPull, 12>>]
103139
D2: [gpio::PA9<Alternate<PushPull, 12>>]
104140
D3: [gpio::PB5<Alternate<PushPull, 12>>]
141+
D4: []
142+
D5: []
143+
D6: [gpio::PB14<Alternate<PushPull, 12>>]
144+
D7: [gpio::PB10<Alternate<PushPull, 12>>]
105145
}
106146

107147
#[cfg(feature = "stm32f411")]
@@ -112,12 +152,17 @@ pins! {
112152
D1: [gpio::PA8<Alternate<PushPull, 12>>]
113153
D2: [gpio::PA9<Alternate<PushPull, 12>>]
114154
D3: [gpio::PB5<Alternate<PushPull, 12>>]
155+
D4: []
156+
D5: []
157+
D6: [gpio::PB14<Alternate<PushPull, 12>>]
158+
D7: [gpio::PB10<Alternate<PushPull, 12>>]
115159
}
116160

117161
#[derive(Copy, Clone, Eq, PartialEq)]
118162
pub enum Buswidth {
119163
Buswidth1 = 0,
120164
Buswidth4 = 1,
165+
Buswidth8 = 2,
121166
}
122167

123168
/// Clock frequency of a SDIO bus.

0 commit comments

Comments
 (0)