Skip to content

Commit f88795d

Browse files
committed
Simplify imports
1 parent 0b107f0 commit f88795d

File tree

1 file changed

+8
-17
lines changed

1 file changed

+8
-17
lines changed

src/adc.rs

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,20 @@ use core::ops::Deref;
1414
use cortex_m::asm;
1515
use embedded_hal::adc::{Channel, OneShot};
1616

17-
use crate::time::rate::Hertz;
1817
use crate::time::duration::Microseconds;
1918
use crate::time::fixed_point::FixedPoint;
19+
use crate::time::rate::Hertz;
2020

2121
use crate::gpio::{self, Analog};
22-
use crate::pac::RCC;
23-
use crate::pac::adc1;
2422
use crate::pac::{
25-
adc1::{cfgr::ALIGN_A, smpr1::SMP9_A, smpr2::SMP18_A},
23+
self,
24+
adc1::{self, cfgr::ALIGN_A, smpr1::SMP9_A, smpr2::SMP18_A},
2625
adc1_2::ccr::CKMODE_A,
26+
RCC,
2727
};
2828
use crate::rcc::{Clocks, AHB};
2929
use stm32f3::Variant;
3030

31-
#[cfg(any(
32-
feature = "stm32f303xb",
33-
feature = "stm32f303xc",
34-
feature = "stm32f303xd",
35-
feature = "stm32f303xe",
36-
))]
37-
use crate::pac::{ADC1, ADC1_2, ADC2, ADC3, ADC3_4, ADC4};
38-
3931
const MAX_ADVREGEN_STARTUP: Microseconds = Microseconds(10);
4032

4133
/// Analog Digital Converter Peripheral
@@ -153,7 +145,7 @@ impl From<Align> for ALIGN_A {
153145
macro_rules! adc_pins {
154146
($ADC:ident, $($pin:ty => $chan:expr),+ $(,)*) => {
155147
$(
156-
impl Channel<$ADC> for $pin {
148+
impl Channel<pac::$ADC> for $pin {
157149
type ID = u8;
158150

159151
fn channel() -> u8 { $chan }
@@ -288,7 +280,6 @@ where
288280
common_adc: &mut <ADC as Instance>::SharedInstance,
289281
ahb: &mut AHB,
290282
) -> Self {
291-
292283
let mut adc = Self {
293284
adc,
294285
operation_mode: None,
@@ -514,9 +505,9 @@ macro_rules! adc {
514505
),
515506
)+) => {
516507
$(
517-
impl crate::private::Sealed for $ADC {}
518-
impl Instance for $ADC {
519-
type SharedInstance = $ADCX_Y;
508+
impl crate::private::Sealed for pac::$ADC {}
509+
impl Instance for pac::$ADC {
510+
type SharedInstance = pac::$ADCX_Y;
520511
fn enable_clock(clocks: &Clocks, ahb: &mut AHB, common_adc: &mut Self::SharedInstance) {
521512
ahb.enr().modify(|_, w| w.$adcXYen().enabled());
522513

0 commit comments

Comments
 (0)