Skip to content

Commit fd57d0e

Browse files
committed
fmt
1 parent 22e8de9 commit fd57d0e

File tree

10 files changed

+56
-49
lines changed

10 files changed

+56
-49
lines changed

src/capture.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ use crate::stm32;
22

33
use super::timer;
44

5-
#[cfg(feature = "stm32g4")]
6-
use crate::mcu::DmaMuxResources;
75
#[cfg(feature = "stm32g4")]
86
use crate::hal::dma::PeripheralToMemory;
7+
#[cfg(feature = "stm32g4")]
8+
use crate::mcu::DmaMuxResources;
99

1010
use core::marker::PhantomData;
1111
#[cfg(feature = "hrtim_v2")]

src/compare_register.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
use core::marker::PhantomData;
22

3-
use crate::stm32::{
4-
HRTIM_MASTER, HRTIM_TIMA, HRTIM_TIMB, HRTIM_TIMC, HRTIM_TIMD, HRTIM_TIME,
5-
};
63
#[cfg(feature = "hrtim_v2")]
74
use crate::stm32::HRTIM_TIMF;
5+
use crate::stm32::{HRTIM_MASTER, HRTIM_TIMA, HRTIM_TIMB, HRTIM_TIMC, HRTIM_TIMD, HRTIM_TIME};
86

97
pub trait HrCompareRegister {
108
fn get_duty(&self) -> u16;
@@ -195,4 +193,4 @@ hrtim_timer_rst! {
195193
hrtim_timer_rst! {
196194
HRTIM_TIMF: HrCr2: 2,
197195
HRTIM_TIMF: HrCr4: 3
198-
}
196+
}

src/control.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
#[cfg(feature = "hrtim_v2")]
2+
use crate::fault::FltMonitor6;
13
use crate::fault::{
24
FltMonitor1, FltMonitor2, FltMonitor3, FltMonitor4, FltMonitor5, FltMonitorSys,
35
};
4-
#[cfg(feature = "hrtim_v2")]
5-
use crate::fault::FltMonitor6;
66

77
use crate::{hal, stm32};
88
use hal::rcc::{Enable, Rcc, Reset};

src/external_event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use crate::stm32;
22

3-
use crate::Polarity;
43
#[cfg(feature = "stm32g4")]
54
use crate::hal::comparator::{COMP1, COMP2, COMP3, COMP4, COMP5, COMP6, COMP7};
65
#[cfg(feature = "stm32g4")]
@@ -9,6 +8,7 @@ use crate::hal::gpio::gpiob::{PB3, PB4, PB5, PB6, PB7, PB8, PB9};
98
use crate::hal::gpio::gpioc::{PC11, PC12, PC5, PC6};
109
#[cfg(feature = "stm32g4")]
1110
use crate::hal::gpio::{self, AF13, AF3};
11+
use crate::Polarity;
1212
use stm32::HRTIM_COMMON;
1313

1414
use super::control::HrTimCalibrated;

src/fault.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ use crate::stm32;
66
use crate::hal::comparator::{COMP1, COMP2, COMP3, COMP4, COMP5, COMP6};
77
#[cfg(feature = "stm32g4")]
88
use crate::hal::gpio::{
9-
self, AF13, AF3,
9+
self,
1010
gpioa::{PA12, PA15},
1111
gpiob::{PB0, PB10, PB11},
1212
gpioc::{PC10, PC7},
13+
AF13, AF3,
1314
};
1415
use stm32::HRTIM_COMMON;
1516

src/lib.rs

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -739,19 +739,30 @@ where
739739
PSCL: HrtimPrescaler,
740740
PINS: ToHrOut<HRTIM_MASTER>,
741741
{
742-
pub fn finalize(self, _control: &mut HrPwmControl,
742+
pub fn finalize(
743+
self,
744+
_control: &mut HrPwmControl,
743745
#[cfg(feature = "stm32f3")]
744746
moder: &mut <PINS::GpioX as hal::gpio::marker::GpioStatic>::MODER,
745747
#[cfg(feature = "stm32f3")]
746748
otyper: &mut <PINS::GpioX as hal::gpio::marker::GpioStatic>::OTYPER,
747-
#[cfg(feature = "stm32f3")]
748-
afr: &mut PINS::Afr
749+
#[cfg(feature = "stm32f3")] afr: &mut PINS::Afr,
749750
) -> HrParts<HRTIM_MASTER, PSCL, ()> {
750-
#[cfg(feature = "stm32f3")]{
751-
hrtim_finalize_body!(self, MasterPreloadSource, HRTIM_MASTER, [], moder, otyper, afr)
751+
#[cfg(feature = "stm32f3")]
752+
{
753+
hrtim_finalize_body!(
754+
self,
755+
MasterPreloadSource,
756+
HRTIM_MASTER,
757+
[],
758+
moder,
759+
otyper,
760+
afr
761+
)
752762
}
753763

754-
#[cfg(feature = "stm32g4")] {
764+
#[cfg(feature = "stm32g4")]
765+
{
755766
hrtim_finalize_body!(self, MasterPreloadSource, HRTIM_MASTER, [],)
756767
}
757768
}

src/output.rs

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
#[cfg(feature = "hrtim_v2")]
32
use crate::stm32::HRTIM_TIMF;
43
use crate::{
@@ -155,13 +154,13 @@ pub trait ToHrOut<TIM>: sealed::Sealed<TIM> {
155154
#[cfg(feature = "stm32f3")]
156155
type Afr;
157156

158-
fn connect_to_hrtim(self,
157+
fn connect_to_hrtim(
158+
self,
159159
#[cfg(feature = "stm32f3")]
160160
moder: &mut <Self::GpioX as hal::gpio::marker::GpioStatic>::MODER,
161161
#[cfg(feature = "stm32f3")]
162162
otyper: &mut <Self::GpioX as hal::gpio::marker::GpioStatic>::OTYPER,
163-
#[cfg(feature = "stm32f3")]
164-
afr: &mut Self::Afr
163+
#[cfg(feature = "stm32f3")] afr: &mut Self::Afr,
165164
);
166165
}
167166

@@ -176,22 +175,23 @@ where
176175
impl<TIM, PA, PB> ToHrOut<TIM> for (PA, PB)
177176
where
178177
PA: ToHrOut<TIM>,
179-
PB: ToHrOut<TIM, GpioX=PA::GpioX, Afr=PA::Afr>,
178+
PB: ToHrOut<TIM, GpioX = PA::GpioX, Afr = PA::Afr>,
180179
{
181180
type Out<PSCL> = (PA::Out<PSCL>, PB::Out<PSCL>);
182181
type GpioX = PA::GpioX;
183182
type Afr = PA::Afr;
184183

185-
fn connect_to_hrtim(self,
186-
184+
fn connect_to_hrtim(
185+
self,
186+
187187
moder: &mut <Self::GpioX as hal::gpio::marker::GpioStatic>::MODER,
188-
188+
189189
otyper: &mut <Self::GpioX as hal::gpio::marker::GpioStatic>::OTYPER,
190-
191-
afr: &mut Self::Afr
190+
191+
afr: &mut Self::Afr,
192192
) {
193-
self.0.connect_to_hrtim(moder, otyper, afr);
194-
self.1.connect_to_hrtim(moder, otyper, afr);
193+
self.0.connect_to_hrtim(moder, otyper, afr);
194+
self.1.connect_to_hrtim(moder, otyper, afr);
195195
}
196196
}
197197

@@ -222,7 +222,7 @@ macro_rules! pins_helper {
222222
#[cfg(feature = "stm32f3")]
223223
type GpioX = hal::gpio::$GpioX;
224224
#[cfg(feature = "stm32f3")]
225-
type Afr = <Self as hal::gpio::marker::IntoAf<{$CHY_AF}>>::AFR;
225+
type Afr = <Self as hal::gpio::marker::IntoAf<{ $CHY_AF }>>::AFR;
226226

227227
// Pin<Gpio, Index, Alternate<PushPull, AF>>
228228
fn connect_to_hrtim(
@@ -231,17 +231,17 @@ macro_rules! pins_helper {
231231
moder: &mut <Self::GpioX as hal::gpio::marker::GpioStatic>::MODER,
232232
#[cfg(feature = "stm32f3")]
233233
otyper: &mut <Self::GpioX as hal::gpio::marker::GpioStatic>::OTYPER,
234-
#[cfg(feature = "stm32f3")]
235-
afr: &mut Self::Afr
234+
#[cfg(feature = "stm32f3")] afr: &mut Self::Afr,
236235
) {
237236
#[allow(non_snake_case, unused_variables)]
238237
let $GpioX = ();
239238

240239
#[cfg(feature = "stm32f3")]
241-
let _: $CHY<hal::gpio::Alternate<hal::gpio::PushPull, $CHY_AF>> = self.into_af_push_pull(moder, otyper, afr);
240+
let _: $CHY<hal::gpio::Alternate<hal::gpio::PushPull, $CHY_AF>> =
241+
self.into_af_push_pull(moder, otyper, afr);
242242

243243
#[cfg(feature = "stm32g4")]
244-
let _: $CHY<hal::gpio::Alternate<{$CHY_AF}>> = self.into_alternate();
244+
let _: $CHY<hal::gpio::Alternate<{ $CHY_AF }>> = self.into_alternate();
245245
}
246246
}
247247
};
@@ -276,14 +276,15 @@ impl<T> ToHrOut<T> for () {
276276
#[cfg(feature = "stm32f3")]
277277
type Afr = ();
278278

279-
fn connect_to_hrtim(self,
279+
fn connect_to_hrtim(
280+
self,
280281
#[cfg(feature = "stm32f3")]
281282
_moder: &mut <Self::GpioX as hal::gpio::marker::GpioStatic>::MODER,
282283
#[cfg(feature = "stm32f3")]
283284
_otyper: &mut <Self::GpioX as hal::gpio::marker::GpioStatic>::OTYPER,
284-
#[cfg(feature = "stm32f3")]
285-
_afr: &mut Self::Afr
286-
) {}
285+
#[cfg(feature = "stm32f3")] _afr: &mut Self::Afr,
286+
) {
287+
}
287288
}
288289

289290
pub struct CH1<PSCL>(PhantomData<PSCL>);

src/stm32f3.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
1-
21
pub use stm32f3xx_hal as hal;
32
//pub use hal::pac as stm32;
43
pub use stm32f3::stm32f3x4 as stm32;
54

65
#[allow(non_camel_case_types, dead_code)]
7-
pub enum DmaMuxResources {
8-
9-
}
6+
pub enum DmaMuxResources {}
107

118
pub type GpioInputMode = hal::gpio::Input;
129

13-
pub enum Alignment { Left }
10+
pub enum Alignment {
11+
Left,
12+
}
1413
#[cfg(feature = "stm32f3")]
1514
pub enum Polarity {
1615
ActiveHigh,
1716
ActiveLow,
18-
}
17+
}

src/stm32g4.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
2-
pub use stm32g4xx_hal as hal;
31
pub use hal::stm32;
2+
pub use stm32g4xx_hal as hal;
43

54
#[allow(non_camel_case_types, dead_code)]
65
pub enum DmaMuxResources {
@@ -18,4 +17,4 @@ pub type GpioInputMode = hal::gpio::Input<hal::gpio::Floating>;
1817
pub use hal::pwm::Alignment;
1918

2019
#[cfg(feature = "stm32g4")]
21-
pub use hal::pwm::Polarity;
20+
pub use hal::pwm::Polarity;

src/timer.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
use crate::stm32::{
2-
HRTIM_MASTER, HRTIM_TIMA, HRTIM_TIMB, HRTIM_TIMC, HRTIM_TIMD, HRTIM_TIME,
3-
};
41
#[cfg(feature = "hrtim_v2")]
52
use crate::stm32::HRTIM_TIMF;
3+
use crate::stm32::{HRTIM_MASTER, HRTIM_TIMA, HRTIM_TIMB, HRTIM_TIMC, HRTIM_TIMD, HRTIM_TIME};
64
use core::marker::PhantomData;
75

86
use super::{

0 commit comments

Comments
 (0)