Skip to content

Commit fc762c9

Browse files
committed
add clock
1 parent e324f19 commit fc762c9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/spi.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ use crate::gpio::gpiob::*;
55
use crate::gpio::{AltMode, Floating, Input};
66
use crate::hal;
77
use crate::pac::SPI1;
8+
#[cfg(any(feature = "stm32l0x2", feature = "stm32l0x3"))]
9+
use crate::pac::SPI2;
810
use crate::rcc::Rcc;
911
use crate::time::Hertz;
1012
use core::ptr;
@@ -122,6 +124,23 @@ pins! {
122124
]
123125
}
124126

127+
#[cfg(any(feature = "stm32l0x2", feature = "stm32l0x3"))]
128+
pins! {
129+
SPI2:
130+
SCK: [
131+
[NoSck, None],
132+
[PB13<Input<Floating>>, AltMode::AF0]
133+
]
134+
MISO: [
135+
[NoMiso, None],
136+
[PB14<Input<Floating>>, AltMode::AF0]
137+
]
138+
MOSI: [
139+
[NoMosi, None],
140+
[PB15<Input<Floating>>, AltMode::AF0]
141+
]
142+
}
143+
125144
#[cfg(feature = "stm32l0x1")]
126145
pins! {
127146
SPI1:
@@ -290,6 +309,12 @@ macro_rules! spi {
290309
}
291310
}
292311

312+
#[cfg(feature = "stm32l0x1")]
293313
spi! {
294314
SPI1: (spi1, apb2enr, spi1en, apb2_clk),
295315
}
316+
317+
#[cfg(any(feature = "stm32l0x2", feature = "stm32l0x3"))]
318+
spi! {
319+
SPI2: (spi2, apb1enr, spi2en, apb1_clk),
320+
}

0 commit comments

Comments
 (0)