Эх сурвалжийг харах

Run format on touched files

James Waples 4 жил өмнө
parent
commit
17bf91831e
2 өөрчлөгдсөн 7 нэмэгдсэн , 26 устгасан
  1. 2 8
      examples/qei.rs
  2. 5 18
      src/qei.rs

+ 2 - 8
examples/qei.rs

@@ -8,13 +8,8 @@ use panic_semihosting as _;
 
 use cortex_m_semihosting::hprintln;
 
-use stm32f1xx_hal::{
-    prelude::*,
-    pac,
-    delay::Delay,
-    timer::Timer,
-};
 use cortex_m_rt::entry;
+use stm32f1xx_hal::{delay::Delay, pac, prelude::*, timer::Timer};
 
 #[entry]
 fn main() -> ! {
@@ -43,8 +38,7 @@ fn main() -> ! {
     let c1 = gpiob.pb6;
     let c2 = gpiob.pb7;
 
-    let qei = Timer::tim4(dp.TIM4, &clocks, &mut rcc.apb1)
-        .qei((c1, c2), &mut afio.mapr);
+    let qei = Timer::tim4(dp.TIM4, &clocks, &mut rcc.apb1).qei((c1, c2), &mut afio.mapr);
     let mut delay = Delay::new(cp.SYST, clocks);
 
     loop {

+ 5 - 18
src/qei.rs

@@ -4,26 +4,21 @@
   NOTE: In some cases you need to specify remap you need, especially for TIM2
   (see [Alternate function remapping](super::timer)):
 */
-
 use core::u16;
 
 use core::marker::PhantomData;
 
 use crate::hal::{self, Direction};
-#[cfg(any(
-    feature = "stm32f100",
-    feature = "stm32f103",
-    feature = "stm32f105",
-))]
+#[cfg(any(feature = "stm32f100", feature = "stm32f103", feature = "stm32f105",))]
 use crate::pac::TIM1;
-use crate::pac::{TIM2, TIM3};
 #[cfg(feature = "medium")]
 use crate::pac::TIM4;
+use crate::pac::{TIM2, TIM3};
 
 use crate::afio::MAPR;
 
-use crate::timer::{Timer, sealed::Remap};
 use crate::pwm_input::Pins;
+use crate::timer::{sealed::Remap, Timer};
 
 pub struct Qei<TIM, REMAP, PINS> {
     tim: TIM,
@@ -31,11 +26,7 @@ pub struct Qei<TIM, REMAP, PINS> {
     _remap: PhantomData<REMAP>,
 }
 
-#[cfg(any(
-    feature = "stm32f100",
-    feature = "stm32f103",
-    feature = "stm32f105",
-))]
+#[cfg(any(feature = "stm32f100", feature = "stm32f103", feature = "stm32f105",))]
 impl Timer<TIM1> {
     pub fn qei<REMAP, PINS>(self, pins: PINS, mapr: &mut MAPR) -> Qei<TIM1, REMAP, PINS>
     where
@@ -143,11 +134,7 @@ macro_rules! hal {
     }
 }
 
-#[cfg(any(
-    feature = "stm32f100",
-    feature = "stm32f103",
-    feature = "stm32f105",
-))]
+#[cfg(any(feature = "stm32f100", feature = "stm32f103", feature = "stm32f105",))]
 hal! {
     TIM1: (_tim1, tim1en, tim1rst),
 }