Skip to content

Commit d612b01

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 b77e82d commit d612b01

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
@@ -110,7 +110,7 @@ macro_rules! hal {
110110
// SSI: set nss high = master mode
111111
// CRCEN: hardware CRC calculation disabled
112112
// BIDIMODE: 2 line unidirectional (full duplex)
113-
spi.cr1.write(|w|
113+
spi.cr1.write(|w| unsafe {
114114
w.cpha()
115115
.bit(mode.phase == Phase::CaptureOnSecondTransition)
116116
.cpol()
@@ -131,7 +131,7 @@ macro_rules! hal {
131131
.clear_bit()
132132
.bidimode()
133133
.clear_bit()
134-
);
134+
});
135135

136136
Spi { spi, pins }
137137
}
@@ -193,7 +193,7 @@ macro_rules! hal {
193193
where F: Into<Hertz>
194194
{
195195
self.spi.cr1.modify(|_, w| w.spe().clear_bit());
196-
self.spi.cr1.modify(|_, w| {
196+
self.spi.cr1.modify(|_, w| unsafe {
197197
w.br().bits(Self::compute_baud_rate(clocks.$pclkX(), freq.into()));
198198
w.spe().set_bit()
199199
});

0 commit comments

Comments
 (0)