Skip to content

Commit 2116717

Browse files
committed
Fixed a number of deprecation warnings and lints
Signed-off-by: Daniel Egger <[email protected]>
1 parent ff1cea2 commit 2116717

File tree

5 files changed

+22
-24
lines changed

5 files changed

+22
-24
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
99

1010
### Changed
1111

12+
- Fixed a few deprecation warning and lints
1213
- Enabled commented out and now available GPIOE support for 07x and 09x families
1314
- Extract register block address only once
1415

src/gpio.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ use embedded_hal::digital::{toggleable, InputPin, OutputPin, StatefulOutputPin};
6666
/// Fully erased pin
6767
pub struct Pin<MODE> {
6868
i: u8,
69-
port: *const GpioRegExt,
69+
port: *const dyn GpioRegExt,
7070
_mode: PhantomData<MODE>,
7171
}
7272

@@ -476,7 +476,7 @@ macro_rules! gpio {
476476
pub fn downgrade(self) -> Pin<Output<MODE>> {
477477
Pin {
478478
i: $i,
479-
port: $GPIOX::ptr() as *const GpioRegExt,
479+
port: $GPIOX::ptr() as *const dyn GpioRegExt,
480480
_mode: self._mode,
481481
}
482482
}
@@ -522,7 +522,7 @@ macro_rules! gpio {
522522
pub fn downgrade(self) -> Pin<Input<MODE>> {
523523
Pin {
524524
i: $i,
525-
port: $GPIOX::ptr() as *const GpioRegExt,
525+
port: $GPIOX::ptr() as *const dyn GpioRegExt,
526526
_mode: self._mode,
527527
}
528528
}

src/rcc.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ pub struct Rcc {
3737
pub(crate) regs: RCC,
3838
}
3939

40-
#[cfg(any(
41-
feature = "stm32f030",
42-
feature = "stm32f070",
43-
))]
40+
#[cfg(any(feature = "stm32f030", feature = "stm32f070",))]
4441
mod inner {
4542
use crate::stm32::{rcc::cfgr::SWW, RCC};
4643

@@ -177,7 +174,7 @@ mod inner {
177174

178175
// Set PLL source and multiplier
179176
rcc.cfgr
180-
.modify(|_, w| unsafe { w.pllsrc().bits(pllsrc_bit).pllmul().bits(pllmul_bits) });
177+
.modify(|_, w| w.pllsrc().bits(pllsrc_bit).pllmul().bits(pllmul_bits));
181178

182179
rcc.cr.write(|w| w.pllon().set_bit());
183180
while rcc.cr.read().pllrdy().bit_is_clear() {}
@@ -313,12 +310,12 @@ impl CFGR {
313310
0 => unreachable!(),
314311
1 => 0b0111,
315312
2 => 0b1000,
316-
3...5 => 0b1001,
317-
6...11 => 0b1010,
318-
12...39 => 0b1011,
319-
40...95 => 0b1100,
320-
96...191 => 0b1101,
321-
192...383 => 0b1110,
313+
3..=5 => 0b1001,
314+
6..=11 => 0b1010,
315+
12..=39 => 0b1011,
316+
40..=95 => 0b1100,
317+
96..=191 => 0b1101,
318+
192..=383 => 0b1110,
322319
_ => 0b1111,
323320
})
324321
.unwrap_or(0b0111);
@@ -331,8 +328,8 @@ impl CFGR {
331328
0 => unreachable!(),
332329
1 => 0b011,
333330
2 => 0b100,
334-
3...5 => 0b101,
335-
6...11 => 0b110,
331+
3..=5 => 0b101,
332+
6..=11 => 0b110,
336333
_ => 0b111,
337334
})
338335
.unwrap_or(0b011);

src/spi.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -281,13 +281,13 @@ where
281281

282282
let br = match clocks.pclk().0 / speed.into().0 {
283283
0 => unreachable!(),
284-
1...2 => 0b000,
285-
3...5 => 0b001,
286-
6...11 => 0b010,
287-
12...23 => 0b011,
288-
24...47 => 0b100,
289-
48...95 => 0b101,
290-
96...191 => 0b110,
284+
1..=2 => 0b000,
285+
3..=5 => 0b001,
286+
6..=11 => 0b010,
287+
12..=23 => 0b011,
288+
24..=47 => 0b100,
289+
48..=95 => 0b101,
290+
96..=191 => 0b110,
291291
_ => 0b111,
292292
};
293293

src/timers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ macro_rules! timers {
188188
let ticks = self.clocks.pclk().0 / frequency;
189189

190190
let psc = cast::u16((ticks - 1) / (1 << 16)).unwrap();
191-
self.tim.psc.write(|w| unsafe { w.psc().bits(psc) });
191+
self.tim.psc.write(|w| w.psc().bits(psc));
192192

193193
let arr = cast::u16(ticks / cast::u32(psc + 1)).unwrap();
194194
self.tim.arr.write(|w| unsafe { w.bits(cast::u32(arr)) });

0 commit comments

Comments
 (0)