Skip to content

Commit 9f56cf6

Browse files
committed
Update for gpio changes
1 parent 992f4a4 commit 9f56cf6

File tree

3 files changed

+21
-24
lines changed

3 files changed

+21
-24
lines changed

src/hrtim/external_event.rs

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ use crate::gpio::{
44
self,
55
gpiob::{PB3, PB4, PB5, PB6, PB7, PB8, PB9},
66
gpioc::{PC11, PC12, PC5, PC6},
7-
AF13, AF3,
87
};
98

109
pub trait EevInputExt<const N: u8> {
@@ -14,8 +13,8 @@ pub trait EevInputExt<const N: u8> {
1413
}
1514

1615
macro_rules! impl_eev_input {
17-
($($N:literal: COMP=[$compX:ident $(, ($compY:ident, $compY_src_bits:literal))*], PINS=[$(($pin:ident, $af:ident)),*])*) => {$(
18-
$(unsafe impl<IM> EevSrcBits<$N> for $pin<gpio::Input<IM>>{
16+
($($N:literal: COMP=[$compX:ident $(, ($compY:ident, $compY_src_bits:literal))*], PINS=[$(($pin:ident, $af:literal)),*])*) => {$(
17+
$(unsafe impl EevSrcBits<$N> for $pin<gpio::Input>{
1918
const SRC_BITS: u8 = 0b00;
2019
fn cfg(self) {
2120
self.into_alternate::<$af>();
@@ -48,14 +47,14 @@ macro_rules! impl_eev_input {
4847
}
4948

5049
impl_eev_input! {
51-
1: COMP = [COMP2], PINS = [(PC12, AF3)]
52-
2: COMP = [COMP4], PINS = [(PC11, AF3)]
53-
3: COMP = [COMP6], PINS = [(PB7, AF13)]
54-
4: COMP = [COMP1, (COMP5, 0b10)], PINS = [(PB6, AF13)]
55-
5: COMP = [COMP3, (COMP7, 0b10)], PINS = [(PB9, AF13)]
56-
6: COMP = [COMP2, (COMP1, 0b10)], PINS = [(PB5, AF13)]
57-
7: COMP = [COMP4], PINS = [(PB4, AF13)]
58-
8: COMP = [COMP6, (COMP3, 0b10)], PINS = [(PB8, AF13)]
59-
9: COMP = [COMP5, (COMP4, 0b11)], PINS = [(PB3, AF13)]
60-
10: COMP = [COMP7], PINS = [(PC5, AF13), (PC6, AF3)]
50+
1: COMP = [COMP2], PINS = [(PC12, 3)]
51+
2: COMP = [COMP4], PINS = [(PC11, 3)]
52+
3: COMP = [COMP6], PINS = [(PB7, 13)]
53+
4: COMP = [COMP1, (COMP5, 0b10)], PINS = [(PB6, 13)]
54+
5: COMP = [COMP3, (COMP7, 0b10)], PINS = [(PB9, 13)]
55+
6: COMP = [COMP2, (COMP1, 0b10)], PINS = [(PB5, 13)]
56+
7: COMP = [COMP4], PINS = [(PB4, 13)]
57+
8: COMP = [COMP6, (COMP3, 0b10)], PINS = [(PB8, 13)]
58+
9: COMP = [COMP5, (COMP4, 0b11)], PINS = [(PB3, 13)]
59+
10: COMP = [COMP7], PINS = [(PC5, 13), (PC6, 3)]
6160
}

src/hrtim/fault.rs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use crate::{
77
gpioa::{PA12, PA15},
88
gpiob::{PB0, PB10, PB11},
99
gpioc::{PC10, PC7},
10-
AF13, AF3,
1110
},
1211
};
1312

@@ -22,7 +21,7 @@ pub trait FaultInput<S> {
2221
macro_rules! impl_faults {
2322
($(
2423
$input:ident:
25-
PINS=[($pin:ident, $af:ident) $(,($pin_b:ident, $af_b:ident))*],
24+
PINS=[($pin:ident, $af:literal) $(,($pin_b:ident, $af_b:literal))*],
2625
COMP=$compX:ident,
2726
)+) => {$(
2827
impl FaultInput<$pin<gpio::Alternate<$af>>> for fault::$input {
@@ -52,10 +51,10 @@ macro_rules! impl_faults {
5251
}
5352

5453
impl_faults!(
55-
FaultInput1: PINS=[(PA12, AF13)], COMP=COMP2,
56-
FaultInput2: PINS=[(PA15, AF13)], COMP=COMP4,
57-
FaultInput3: PINS=[(PB10, AF13)], COMP=COMP6,
58-
FaultInput4: PINS=[(PB11, AF13)], COMP=COMP1,
59-
FaultInput5: PINS=[(PB0, AF13), (PC7, AF3)], COMP=COMP3,
60-
FaultInput6: PINS=[(PC10, AF13)], COMP=COMP5,
54+
FaultInput1: PINS=[(PA12, 13)], COMP=COMP2,
55+
FaultInput2: PINS=[(PA15, 13)], COMP=COMP4,
56+
FaultInput3: PINS=[(PB10, 13)], COMP=COMP6,
57+
FaultInput4: PINS=[(PB11, 13)], COMP=COMP1,
58+
FaultInput5: PINS=[(PB0, 13), (PC7, 3)], COMP=COMP3,
59+
FaultInput6: PINS=[(PC10, 13)], COMP=COMP5,
6160
);

src/hrtim/mod.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use crate::{
99
gpio,
1010
rcc::{Enable, Reset},
1111
stm32::{
12-
self, HRTIM_COMMON, HRTIM_TIMA, HRTIM_TIMB, HRTIM_TIMC, HRTIM_TIMD, HRTIM_TIME, HRTIM_TIMF,
12+
HRTIM_COMMON, HRTIM_TIMA, HRTIM_TIMB, HRTIM_TIMC, HRTIM_TIMD, HRTIM_TIME, HRTIM_TIMF,
1313
},
1414
};
1515
use stm32_hrtim::{
@@ -25,8 +25,7 @@ pub trait HrControltExt {
2525
}
2626

2727
impl HrControltExt for crate::stm32::HRTIM_COMMON {
28-
fn hr_control(self, _rcc: &mut crate::rcc::Rcc) -> HrTimOngoingCalibration {
29-
let rcc = unsafe { &*stm32::RCC::ptr() };
28+
fn hr_control(self, rcc: &mut crate::rcc::Rcc) -> HrTimOngoingCalibration {
3029
HRTIM_COMMON::enable(rcc);
3130
HRTIM_COMMON::reset(rcc);
3231

0 commit comments

Comments
 (0)