Skip to content

Commit 2eb01d1

Browse files
committed
fix some more warnings
1 parent 609f5a5 commit 2eb01d1

File tree

3 files changed

+29
-26
lines changed

3 files changed

+29
-26
lines changed

src/can.rs

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//!
33
44
use crate::gpio::{self, NoPin};
5-
use crate::pac::{CAN1, CAN2};
5+
use crate::pac;
66
use crate::rcc;
77

88
pub trait Instance: crate::Sealed + rcc::Enable + rcc::Reset + gpio::alt::CanCommon {}
@@ -16,22 +16,22 @@ macro_rules! can {
1616
}
1717

1818
// Implemented by all SPI instances
19-
can! { CAN1: Can1 }
20-
can! { CAN2: Can2 }
19+
can! { pac::CAN1: Can1 }
20+
#[cfg(feature = "can2")]
21+
can! { pac::CAN2: Can2 }
2122
#[cfg(feature = "can3")]
22-
can! { crate::pac::CAN3: Can3 }
23+
can! { pac::CAN3: Can3 }
2324

2425
/// Pins and definitions for models with a third CAN peripheral
2526
#[cfg(feature = "can3")]
2627
mod can3 {
2728
use super::*;
28-
use crate::pac::CAN3;
2929

30-
unsafe impl bxcan::Instance for Can<CAN3> {
31-
const REGISTERS: *mut bxcan::RegisterBlock = CAN3::ptr() as *mut _;
30+
unsafe impl bxcan::Instance for Can<pac::CAN3> {
31+
const REGISTERS: *mut bxcan::RegisterBlock = pac::CAN3::ptr() as *mut _;
3232
}
3333

34-
unsafe impl bxcan::FilterOwner for Can<CAN3> {
34+
unsafe impl bxcan::FilterOwner for Can<pac::CAN3> {
3535
const NUM_FILTER_BANKS: u8 = 14;
3636
}
3737
}
@@ -110,16 +110,17 @@ impl<CAN: Instance> Can<CAN> {
110110
}
111111
}
112112

113-
unsafe impl bxcan::Instance for Can<CAN1> {
114-
const REGISTERS: *mut bxcan::RegisterBlock = CAN1::ptr() as *mut _;
113+
unsafe impl bxcan::Instance for Can<pac::CAN1> {
114+
const REGISTERS: *mut bxcan::RegisterBlock = pac::CAN1::ptr() as *mut _;
115115
}
116116

117-
unsafe impl bxcan::Instance for Can<CAN2> {
118-
const REGISTERS: *mut bxcan::RegisterBlock = CAN2::ptr() as *mut _;
117+
#[cfg(feature = "can2")]
118+
unsafe impl bxcan::Instance for Can<pac::CAN2> {
119+
const REGISTERS: *mut bxcan::RegisterBlock = pac::CAN2::ptr() as *mut _;
119120
}
120121

121-
unsafe impl bxcan::FilterOwner for Can<CAN1> {
122+
unsafe impl bxcan::FilterOwner for Can<pac::CAN1> {
122123
const NUM_FILTER_BANKS: u8 = 28;
123124
}
124125

125-
unsafe impl bxcan::MasterInstance for Can<CAN1> {}
126+
unsafe impl bxcan::MasterInstance for Can<pac::CAN1> {}

src/fmpi2c.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,15 @@ impl From<Hertz> for Mode {
9999
}
100100

101101
pub trait I2cExt: Sized + Instance {
102-
fn i2c<'a>(
102+
fn i2c(
103103
self,
104104
pins: (impl Into<Self::Scl>, impl Into<Self::Sda>),
105105
mode: impl Into<Mode>,
106106
) -> I2c<Self>;
107107
}
108108

109109
impl<I2C: Instance> I2cExt for I2C {
110-
fn i2c<'a>(
110+
fn i2c(
111111
self,
112112
pins: (impl Into<Self::Scl>, impl Into<Self::Sda>),
113113
mode: impl Into<Mode>,

src/sai.rs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
use core::ops::Deref;
2323

2424
use crate::gpio::alt::SaiChannel;
25-
use crate::pac::RCC;
2625
#[cfg(feature = "sai2")]
2726
use crate::pac::SAI2;
2827
#[cfg(any(
@@ -539,9 +538,10 @@ where
539538
where
540539
Self: Sized,
541540
{
542-
let rcc = unsafe { &*RCC::ptr() };
543-
SAI::enable(rcc);
544-
SAI::reset(rcc);
541+
unsafe {
542+
SAI::enable_unchecked();
543+
SAI::reset_unchecked();
544+
}
545545
(
546546
SubBlock {
547547
channel: SAIA::new(self),
@@ -565,9 +565,10 @@ where
565565
where
566566
Self: Sized,
567567
{
568-
let rcc = unsafe { &*RCC::ptr() };
569-
SAI::enable(rcc);
570-
SAI::reset(rcc);
568+
unsafe {
569+
SAI::enable_unchecked();
570+
SAI::reset_unchecked();
571+
}
571572
(
572573
SubBlock {
573574
channel: SAIA::new(self),
@@ -591,9 +592,10 @@ where
591592
where
592593
Self: Sized,
593594
{
594-
let rcc = unsafe { &*RCC::ptr() };
595-
SAI::enable(rcc);
596-
SAI::reset(rcc);
595+
unsafe {
596+
SAI::enable_unchecked();
597+
SAI::reset_unchecked();
598+
}
597599
(
598600
SubBlock {
599601
channel: SAIA::new(self),

0 commit comments

Comments
 (0)