Skip to content

Commit 0156c1f

Browse files
author
Henrik Snöman
committed
Fixed compile issues
1 parent 76b4801 commit 0156c1f

File tree

3 files changed

+37
-17
lines changed

3 files changed

+37
-17
lines changed

.cargo/config.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[target.thumbv8m.main-none-eabihf]
2-
runner = 'probe-rs run --connect-under-reset'
2+
runner = 'probe-rs run --chip STM32H523RETx'
33
rustflags = [
44
# LLD (shipped with the Rust toolchain) is used as the default linker
55
"-C", "link-arg=-Tlink.x",

src/pwm/mod.rs

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,22 +1019,23 @@ tim_hal! {
10191019
pac::TIM1: (tim1, Tim1, u16, 16, DIR: cms, BDTR: bdtr, enabled, af1, clear_bit, clear_bit),
10201020
pac::TIM2: (tim2, Tim2, u32, 32, DIR: cms),
10211021
pac::TIM3: (tim3, Tim3, u16, 16, DIR: cms),
1022+
pac::TIM6: (tim6, Tim6, u16, 16),
1023+
pac::TIM7: (tim7, Tim7, u16, 16),
1024+
}
1025+
1026+
#[cfg(feature="rm0481")]
1027+
tim_hal! {
10221028
pac::TIM4: (tim4, Tim4, u16, 16, DIR: cms),
10231029
pac::TIM5: (tim5, Tim5, u32, 32, DIR: cms),
10241030
pac::TIM8: (tim8, Tim8, u16, 16, DIR: cms, BDTR: bdtr, enabled, af1, clear_bit, clear_bit),
1025-
}
1026-
#[cfg(feature = "rm0468")]
1027-
tim_hal! {
1028-
pac::TIM23: (tim23, Tim23, u32, 32, DIR: cms),
1029-
pac::TIM24: (tim24, Tim24, u32, 32, DIR: cms),
1030-
}
1031+
//pac::TIM12: (tim12, Tim12, u16, 16),
1032+
pac::TIM15: (tim15, Tim15, u16, 16, BDTR: bdtr, set_bit, af1, set_bit),
1033+
} // TODO: TIM12 seems to be missing for 523's pac, re add once fixed
1034+
1035+
#[cfg(feature="h56x_h573")]
10311036
tim_hal! {
1032-
pac::TIM12: (tim12, Tim12, u16, 16),
10331037
pac::TIM13: (tim13, Tim13, u16, 16),
10341038
pac::TIM14: (tim14, Tim14, u16, 16),
1035-
}
1036-
tim_hal! {
1037-
pac::TIM15: (tim15, Tim15, u16, 16, BDTR: bdtr, set_bit, af1, set_bit),
10381039
pac::TIM16: (tim16, Tim16, u16, 16, BDTR: bdtr, set_bit, af1, set_bit),
10391040
pac::TIM17: (tim17, Tim17, u16, 16, BDTR: bdtr, set_bit, af1, set_bit),
10401041
}
@@ -1220,36 +1221,44 @@ macro_rules! tim_pin_hal {
12201221
};
12211222
}
12221223

1223-
fn foo(tim: pac::TIM12) {
1224+
fn foo(tim: pac::TIM1) {
12241225
const C: u8 = 0;
12251226
let value = 3;
12261227
tim.psc().modify(|_, w| w.psc().set(value));
12271228

12281229
tim.ccer().modify(|_, w| w.ccp(C).falling_edge());
1230+
tim.cr1().modify(|_, w| w.dir().down());
1231+
tim.cr1().modify(|_, w| w.cms().center_aligned3());
12291232
}
12301233

12311234
// Dual channel timers
1235+
/*#[cfg(feature="rm0481")]
12321236
tim_pin_hal! {
12331237
pac::TIM12, u16:
12341238
(C1, ccmr1_output, oc1pe, oc1m),
12351239
(C2, ccmr1_output, oc2pe, oc2m),
1236-
}
1240+
}*/ // TODO: TIM12 seems to be missing for 523's pac, re add once fixed
1241+
#[cfg(feature="rm0481")]
12371242
tim_pin_hal! {
12381243
pac::TIM15, u16, ccne:
12391244
(C1, ccmr1_output, oc1pe, oc1m),
12401245
(C2, ccmr1_output, oc2pe, oc2m),
12411246
}
12421247

12431248
// Single channel timers
1249+
#[cfg(feature="h56x_h573")]
12441250
tim_pin_hal! {
12451251
pac::TIM13, u16: (C1, ccmr1_output, oc1pe, oc1m),
12461252
}
1253+
#[cfg(feature="h56x_h573")]
12471254
tim_pin_hal! {
12481255
pac::TIM14, u16: (C1, ccmr1_output, oc1pe, oc1m),
12491256
}
1257+
#[cfg(feature="h56x_h573")]
12501258
tim_pin_hal! {
12511259
pac::TIM16, u16: (C1, ccmr1_output, oc1pe, oc1m),
12521260
}
1261+
#[cfg(feature="h56x_h573")]
12531262
tim_pin_hal! {
12541263
pac::TIM17, u16: (C1, ccmr1_output, oc1pe, oc1m),
12551264
}
@@ -1276,20 +1285,23 @@ tim_pin_hal! {
12761285
(C3, ccmr2_output, oc3pe, oc3m),
12771286
(C4, ccmr2_output, oc4pe, oc4m),
12781287
}
1288+
#[cfg(feature="rm0481")]
12791289
tim_pin_hal! {
12801290
pac::TIM4, u16:
12811291
(C1, ccmr1_output, oc1pe, oc1m),
12821292
(C2, ccmr1_output, oc2pe, oc2m),
12831293
(C3, ccmr2_output, oc3pe, oc3m),
12841294
(C4, ccmr2_output, oc4pe, oc4m),
12851295
}
1296+
#[cfg(feature="rm0481")]
12861297
tim_pin_hal! {
12871298
pac::TIM5, u32:
12881299
(C1, ccmr1_output, oc1pe, oc1m),
12891300
(C2, ccmr1_output, oc2pe, oc2m),
12901301
(C3, ccmr2_output, oc3pe, oc3m),
12911302
(C4, ccmr2_output, oc4pe, oc4m),
12921303
}
1304+
#[cfg(feature="rm0481")]
12931305
tim_pin_hal! {
12941306
pac::TIM8, u16, ccne:
12951307
(C1, ccmr1_output, oc1pe, oc1m),

src/timer.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,12 @@ use core::marker::PhantomData;
1313
use crate::stm32::{TIM1, TIM2, TIM3, TIM6, TIM7};
1414
#[cfg(feature = "rm0481")]
1515
use crate::stm32::{
16-
TIM12, TIM13, TIM14, TIM15, TIM16, TIM17, TIM4, TIM5, TIM8,
16+
TIM4, TIM5, TIM8, /*TIM12,*/ TIM15,
1717
}; // TODO: TIM12 seems to be missing for 523's pac, re add once fixed
18-
18+
#[cfg(feature = "h56x_h573")]
19+
use crate::stm32::{
20+
TIM13, TIM14, TIM16, TIM17,
21+
};
1922
use cast::{u16, u32};
2023
use void::Void;
2124

@@ -48,8 +51,13 @@ impl_tim_ker_ck! {
4851

4952
#[cfg(feature = "rm0481")]
5053
impl_tim_ker_ck! {
51-
timx_ker_ck: TIM4, TIM5, TIM12, TIM13, TIM14 // TODO: TIM12 seems to be missing for 523's pac, re add once fixed
52-
timy_ker_ck: TIM8, TIM15, TIM16, TIM17
54+
timx_ker_ck: TIM4, TIM5 /*TIM12,*/ // TODO: TIM12 seems to be missing for 523's pac, re add once fixed
55+
timy_ker_ck: TIM8, TIM15
56+
}
57+
58+
#[cfg(feature = "h56x_h573")]
59+
impl_tim_ker_ck! {
60+
timx_ker_ck: TIM13, TIM14
5361
}
5462

5563
/// External trait for hardware timers

0 commit comments

Comments
 (0)