Skip to content

Commit dad6166

Browse files
committed
src/spi.rs: add unsafe where required by stm32l4r9 PAC.
To make this implementation also usable by stm32l4+ devices, some additional use of `unsafe` is necessary because of PAC differences.
1 parent 742b92b commit dad6166

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/spi.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ macro_rules! hal {
109109
// SSI: set nss high = master mode
110110
// CRCEN: hardware CRC calculation disabled
111111
// BIDIMODE: 2 line unidirectional (full duplex)
112-
spi.cr1.write(|w|
112+
spi.cr1.write(|w| unsafe {
113113
w.cpha()
114114
.bit(mode.phase == Phase::CaptureOnSecondTransition)
115115
.cpol()
@@ -130,7 +130,7 @@ macro_rules! hal {
130130
.clear_bit()
131131
.bidimode()
132132
.clear_bit()
133-
);
133+
});
134134

135135
Spi { spi, pins }
136136
}
@@ -190,7 +190,7 @@ macro_rules! hal {
190190
/// Change the baud rate of the SPI
191191
pub fn reclock(&mut self, freq: Hertz, clocks: Clocks) {
192192
self.spi.cr1.modify(|_, w| w.spe().clear_bit());
193-
self.spi.cr1.modify(|_, w| {
193+
self.spi.cr1.modify(|_, w| unsafe {
194194
w.br().bits(Self::compute_baud_rate(clocks.$pclkX(), freq));
195195
w.spe().set_bit()
196196
});

0 commit comments

Comments
 (0)