Skip to content

Commit 562ab69

Browse files
committed
code cleanup
1 parent 605131e commit 562ab69

File tree

8 files changed

+13
-15
lines changed

8 files changed

+13
-15
lines changed

examples/adc_ext_trig_double_dma_serial.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,11 @@ use rt::entry;
2323
use core::cell::RefCell;
2424
use cortex_m::interrupt::Mutex;
2525

26-
use crate::hal::stm32::{interrupt, Interrupt};
27-
use hal::analog::adc::{InjTrigSource, Precision, SampleTime}; //, VTemp
28-
29-
use hal::dma::{self, Target, Channel};
30-
3126
use crate::hal::analog::adc::DmaMode;
3227
use crate::hal::analog::adc::InjectMode;
28+
use crate::hal::stm32::{interrupt, Interrupt};
29+
use hal::analog::adc::{InjTrigSource, Precision, SampleTime}; //, VTemp
30+
use hal::dma::{self, Channel, Target};
3331

3432
// Make dma globally available
3533
static G_DMA: Mutex<RefCell<Option<hal::dma::Channels>>> = Mutex::new(RefCell::new(None));

examples/dac.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ extern crate panic_halt;
1212
extern crate stm32g0xx_hal as hal;
1313

1414
use hal::analog::dac::GeneratorConfig;
15-
use hal::timer::qei::Direction;
1615
use hal::prelude::*;
1716
use hal::rcc::Config;
1817
use hal::stm32;
18+
use hal::timer::qei::Direction;
1919
use rt::entry;
2020

2121
#[entry]

src/analog/adc.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,11 @@ impl Adc {
277277
adc_mv as u16
278278
})
279279
}
280-
281-
pub fn read<PIN: Channel<Adc, ID = u8>>(&mut self, _pin: &mut PIN) -> nb::Result<u16, Infallible> {
280+
281+
pub fn read<PIN: Channel<Adc, ID = u8>>(
282+
&mut self,
283+
_pin: &mut PIN,
284+
) -> nb::Result<u16, Infallible> {
282285
self.power_up();
283286
self.rb.cfgr1.modify(|_, w| {
284287
w.res()

src/dma.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,6 @@ macro_rules! dma {
334334
}
335335
}
336336

337-
338337
#[cfg(any(feature = "stm32g070", feature = "stm32g071", feature = "stm32g081"))]
339338
dma!(
340339
channels: {

src/gpio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use core::marker::PhantomData;
33

44
use crate::rcc::Rcc;
55
use core::convert::Infallible;
6-
use hal::digital::{InputPin, OutputPin, StatefulOutputPin, ErrorType, PinState};
6+
use hal::digital::{ErrorType, InputPin, OutputPin, PinState, StatefulOutputPin};
77

88
/// Default pin mode
99
pub type DefaultMode = Analog;

src/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
pub use hal::digital::*;
21
pub use crate::analog::adc::AdcExt as _;
32
#[cfg(any(feature = "stm32g071", feature = "stm32g081"))]
43
pub use crate::analog::comparator::ComparatorExt as _;
@@ -12,6 +11,7 @@ pub use crate::analog::dac::DacExt as _;
1211
pub use crate::analog::dac::DacOut as _;
1312
pub use crate::crc::CrcExt as _;
1413
pub use crate::timer::delay::DelayExt as _;
14+
pub use hal::digital::*;
1515
// pub use crate::dma::CopyDma as _;
1616
pub use crate::dma::DmaExt as _;
1717
// pub use crate::dma::ReadDma as _;

src/serial/usart.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
use core::fmt;
2-
use core::marker::PhantomData;
31
use crate::dma;
42
use crate::dmamux::DmaMuxIndex;
53
use crate::gpio::{AltFunction, *};
64
use crate::rcc::*;
75
use crate::serial::config::*;
86
use crate::stm32::*;
7+
use core::fmt;
8+
use core::marker::PhantomData;
99
use cortex_m::interrupt;
1010
use nb::block;
1111

@@ -530,7 +530,6 @@ macro_rules! uart_basic {
530530
.write(|w| unsafe { w.bits(event.val() & mask) });
531531
}
532532
}
533-
534533

535534
impl fmt::Write for Tx<$USARTX, BasicConfig> {
536535
fn write_str(&mut self, s: &str) -> fmt::Result {

src/timer/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ impl Timer<SYST> {
6969
}
7070
}
7171

72-
7372
pub trait TimerExt<TIM> {
7473
fn timer(self, rcc: &mut Rcc) -> Timer<TIM>;
7574
}

0 commit comments

Comments
 (0)