Skip to content

Commit a5a28b7

Browse files
committed
Some fixes for H7
1 parent 1eb2b31 commit a5a28b7

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/control.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,6 @@ impl HrTimOngoingCalibration {
156156
.fltinr2()
157157
.write(|w| w.fltsd().bits(flt_divider as u8));
158158

159-
#[cfg(feature = "stm32h7")]
160-
let please_dont_forget_to_remove_this_once_pac_is_fixed = ();
161-
162-
#[cfg(not(feature = "stm32h7"))]
163159
common.eecr3().write(|w| w.eevsd().bits(eev_divider as u8));
164160

165161
#[cfg(feature = "stm32g4")]

src/lib.rs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ pub trait HrPwmAdvExt: Sized {
178178
self,
179179
_pins: PINS,
180180
rcc: &mut Rcc,
181-
) -> HrPwmBuilder<Self, Pscl128, Self::PreloadSource, PINS>
181+
) -> HrPwmBuilder<Self, PsclDefault, Self::PreloadSource, PINS>
182182
where
183183
PINS: ToHrOut<Self>;
184184
}
@@ -551,7 +551,7 @@ macro_rules! hrtim_hal {
551551
self,
552552
pins: PINS,
553553
_rcc: &mut Rcc,
554-
) -> HrPwmBuilder<Self, Pscl128, Self::PreloadSource, PINS>
554+
) -> HrPwmBuilder<Self, PsclDefault, Self::PreloadSource, PINS>
555555
where
556556
PINS: ToHrOut<$TIMX>,
557557
{
@@ -705,7 +705,7 @@ impl HrPwmAdvExt for HRTIM_MASTER {
705705
self,
706706
pins: PINS,
707707
_rcc: &mut Rcc,
708-
) -> HrPwmBuilder<Self, Pscl128, Self::PreloadSource, PINS>
708+
) -> HrPwmBuilder<Self, PsclDefault, Self::PreloadSource, PINS>
709709
where
710710
PINS: ToHrOut<HRTIM_MASTER>,
711711
{
@@ -815,6 +815,13 @@ macro_rules! impl_pscl {
815815
)+};
816816
}
817817

818+
#[cfg(any(feature = "stm32f3", feature = "stm32g4"))]
819+
pub type PsclDefault = Pscl128;
820+
821+
#[cfg(feature = "stm32h7")]
822+
pub type PsclDefault = Pscl4;
823+
824+
#[cfg(any(feature = "stm32f3", feature = "stm32g4"))]
818825
impl_pscl! {
819826
Pscl1 => 0b000, 1, 0x0060, 0xFFDF
820827
Pscl2 => 0b001, 2, 0x0030, 0xFFEF
@@ -826,6 +833,13 @@ impl_pscl! {
826833
Pscl128 => 0b111, 128, 0x0003, 0xFFFD
827834
}
828835

836+
#[cfg(feature = "stm32h7")]
837+
impl_pscl! {
838+
Pscl1 => 0b101, 1, 0x0003, 0xFFFD
839+
Pscl2 => 0b110, 2, 0x0003, 0xFFFD
840+
Pscl4 => 0b111, 4, 0x0003, 0xFFFD
841+
}
842+
829843
/*
830844
/// HrTim timer
831845
struct TimerHrTim<PSC>(PhantomData<PSC>);

0 commit comments

Comments
 (0)