aboutsummaryrefslogtreecommitdiff
path: root/embassy-stm32/src/timer/mod.rs
diff options
context:
space:
mode:
authoreZio Pan <[email protected]>2024-02-01 23:04:39 +0800
committerDario Nieuwenhuis <[email protected]>2024-02-10 00:00:43 +0100
commit5b646bc3bd0c4a2cd9acf6a59b3a76f2bbcb0bfb (patch)
treede3fb8ead0d144bae179f6750f11860887a88690 /embassy-stm32/src/timer/mod.rs
parentd538829f2f3542c78ee9eb218c0b5c982acfb46b (diff)
stm32-timer: L0 is special
Diffstat (limited to 'embassy-stm32/src/timer/mod.rs')
-rw-r--r--embassy-stm32/src/timer/mod.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/embassy-stm32/src/timer/mod.rs b/embassy-stm32/src/timer/mod.rs
index 2f5d5770a..8be96b414 100644
--- a/embassy-stm32/src/timer/mod.rs
+++ b/embassy-stm32/src/timer/mod.rs
@@ -12,6 +12,7 @@
12// | +--------------------------------------|-----------+ 12// | +--------------------------------------|-----------+
13// +----------------------------------------------------+ 13// +----------------------------------------------------+
14 14
15#[cfg(not(any(stm32l0, stm32l1)))]
15pub mod complementary_pwm; 16pub mod complementary_pwm;
16pub mod qei; 17pub mod qei;
17pub mod simple_pwm; 18pub mod simple_pwm;
@@ -163,6 +164,7 @@ pub(crate) mod sealed {
163 }; 164 };
164 } 165 }
165 166
167 #[cfg(not(any(stm32l0, stm32l1)))]
166 macro_rules! add_complementary_capture_compare_methods { 168 macro_rules! add_complementary_capture_compare_methods {
167 ($regs:ident) => { 169 ($regs:ident) => {
168 /// Set complementary output polarity. 170 /// Set complementary output polarity.
@@ -374,6 +376,7 @@ pub(crate) mod sealed {
374 add_capture_compare_dma_methods!(regs_gp16); 376 add_capture_compare_dma_methods!(regs_gp16);
375 } 377 }
376 378
379 #[cfg(not(any(stm32l0)))]
377 /// Gneral-purpose 32-bit timer instance. 380 /// Gneral-purpose 32-bit timer instance.
378 pub trait GeneralPurpose32bitInstance: GeneralPurpose16bitInstance { 381 pub trait GeneralPurpose32bitInstance: GeneralPurpose16bitInstance {
379 /// Get access to the general purpose 32bit timer registers. 382 /// Get access to the general purpose 32bit timer registers.
@@ -434,6 +437,7 @@ pub(crate) mod sealed {
434 } 437 }
435 } 438 }
436 439
440 #[cfg(not(any(stm32l0, stm32l1)))]
437 /// Gneral-purpose 1 channel with one complementary 16-bit timer instance. 441 /// Gneral-purpose 1 channel with one complementary 16-bit timer instance.
438 pub trait GeneralPurpose1ChannelComplementaryInstance: BasicNoCr2Instance + GeneralPurpose1ChannelInstance { 442 pub trait GeneralPurpose1ChannelComplementaryInstance: BasicNoCr2Instance + GeneralPurpose1ChannelInstance {
439 /// Get access to the general purpose 1 channel with one complementary 16bit timer registers. 443 /// Get access to the general purpose 1 channel with one complementary 16bit timer registers.
@@ -462,6 +466,7 @@ pub(crate) mod sealed {
462 add_complementary_capture_compare_methods!(regs_1ch_cmp); 466 add_complementary_capture_compare_methods!(regs_1ch_cmp);
463 } 467 }
464 468
469 #[cfg(not(any(stm32l0, stm32l1)))]
465 /// Gneral-purpose 2 channel with one complementary 16-bit timer instance. 470 /// Gneral-purpose 2 channel with one complementary 16-bit timer instance.
466 pub trait GeneralPurpose2ChannelComplementaryInstance: 471 pub trait GeneralPurpose2ChannelComplementaryInstance:
467 BasicInstance + GeneralPurpose2ChannelInstance + GeneralPurpose1ChannelComplementaryInstance 472 BasicInstance + GeneralPurpose2ChannelInstance + GeneralPurpose1ChannelComplementaryInstance
@@ -477,6 +482,7 @@ pub(crate) mod sealed {
477 add_complementary_capture_compare_methods!(regs_2ch_cmp); 482 add_complementary_capture_compare_methods!(regs_2ch_cmp);
478 } 483 }
479 484
485 #[cfg(not(any(stm32l0, stm32l1)))]
480 /// Advanced control timer instance. 486 /// Advanced control timer instance.
481 pub trait AdvancedControlInstance: 487 pub trait AdvancedControlInstance:
482 GeneralPurpose2ChannelComplementaryInstance + GeneralPurpose16bitInstance 488 GeneralPurpose2ChannelComplementaryInstance + GeneralPurpose16bitInstance
@@ -699,18 +705,21 @@ pub trait GeneralPurpose16bitInstance:
699{ 705{
700} 706}
701 707
708#[cfg(not(stm32l0))]
702/// Gneral-purpose 32-bit timer instance. 709/// Gneral-purpose 32-bit timer instance.
703pub trait GeneralPurpose32bitInstance: 710pub trait GeneralPurpose32bitInstance:
704 sealed::GeneralPurpose32bitInstance + GeneralPurpose16bitInstance + 'static 711 sealed::GeneralPurpose32bitInstance + GeneralPurpose16bitInstance + 'static
705{ 712{
706} 713}
707 714
715#[cfg(not(any(stm32l0, stm32l1)))]
708/// General-purpose 1 channel with one complementary 16-bit timer instance. 716/// General-purpose 1 channel with one complementary 16-bit timer instance.
709pub trait GeneralPurpose1ChannelComplementaryInstance: 717pub trait GeneralPurpose1ChannelComplementaryInstance:
710 sealed::GeneralPurpose1ChannelComplementaryInstance + GeneralPurpose1ChannelInstance + 'static 718 sealed::GeneralPurpose1ChannelComplementaryInstance + GeneralPurpose1ChannelInstance + 'static
711{ 719{
712} 720}
713 721
722#[cfg(not(any(stm32l0, stm32l1)))]
714/// General-purpose 2 channel with one complementary 16-bit timer instance. 723/// General-purpose 2 channel with one complementary 16-bit timer instance.
715pub trait GeneralPurpose2ChannelComplementaryInstance: 724pub trait GeneralPurpose2ChannelComplementaryInstance:
716 sealed::GeneralPurpose2ChannelComplementaryInstance 725 sealed::GeneralPurpose2ChannelComplementaryInstance
@@ -721,6 +730,7 @@ pub trait GeneralPurpose2ChannelComplementaryInstance:
721{ 730{
722} 731}
723 732
733#[cfg(not(any(stm32l0, stm32l1)))]
724/// Advanced control timer instance. 734/// Advanced control timer instance.
725pub trait AdvancedControlInstance: 735pub trait AdvancedControlInstance:
726 sealed::AdvancedControlInstance + GeneralPurpose2ChannelComplementaryInstance + GeneralPurpose16bitInstance + 'static 736 sealed::AdvancedControlInstance + GeneralPurpose2ChannelComplementaryInstance + GeneralPurpose16bitInstance + 'static
@@ -738,18 +748,28 @@ pin_trait!(ExternalTriggerPin, GeneralPurpose16bitInstance);
738#[cfg(stm32l0)] 748#[cfg(stm32l0)]
739pin_trait!(ExternalTriggerPin, GeneralPurpose2ChannelInstance); 749pin_trait!(ExternalTriggerPin, GeneralPurpose2ChannelInstance);
740 750
751#[cfg(not(any(stm32l0, stm32l1)))]
741pin_trait!(Channel1ComplementaryPin, GeneralPurpose1ChannelComplementaryInstance); 752pin_trait!(Channel1ComplementaryPin, GeneralPurpose1ChannelComplementaryInstance);
753#[cfg(not(any(stm32l0, stm32l1)))]
742pin_trait!(Channel2ComplementaryPin, GeneralPurpose2ChannelComplementaryInstance); 754pin_trait!(Channel2ComplementaryPin, GeneralPurpose2ChannelComplementaryInstance);
755#[cfg(not(any(stm32l0, stm32l1)))]
743pin_trait!(Channel3ComplementaryPin, AdvancedControlInstance); 756pin_trait!(Channel3ComplementaryPin, AdvancedControlInstance);
757#[cfg(not(any(stm32l0, stm32l1)))]
744pin_trait!(Channel4ComplementaryPin, AdvancedControlInstance); 758pin_trait!(Channel4ComplementaryPin, AdvancedControlInstance);
745 759
760#[cfg(not(any(stm32l0, stm32l1)))]
746pin_trait!(BreakInputPin, GeneralPurpose1ChannelComplementaryInstance); 761pin_trait!(BreakInputPin, GeneralPurpose1ChannelComplementaryInstance);
762#[cfg(not(any(stm32l0, stm32l1)))]
747pin_trait!(BreakInput2Pin, GeneralPurpose2ChannelComplementaryInstance); 763pin_trait!(BreakInput2Pin, GeneralPurpose2ChannelComplementaryInstance);
748 764
765#[cfg(not(any(stm32l0, stm32l1)))]
749pin_trait!(BreakInputComparator1Pin, GeneralPurpose1ChannelComplementaryInstance); 766pin_trait!(BreakInputComparator1Pin, GeneralPurpose1ChannelComplementaryInstance);
767#[cfg(not(any(stm32l0, stm32l1)))]
750pin_trait!(BreakInputComparator2Pin, AdvancedControlInstance); 768pin_trait!(BreakInputComparator2Pin, AdvancedControlInstance);
751 769
770#[cfg(not(any(stm32l0, stm32l1)))]
752pin_trait!(BreakInput2Comparator1Pin, AdvancedControlInstance); 771pin_trait!(BreakInput2Comparator1Pin, AdvancedControlInstance);
772#[cfg(not(any(stm32l0, stm32l1)))]
753pin_trait!(BreakInput2Comparator2Pin, AdvancedControlInstance); 773pin_trait!(BreakInput2Comparator2Pin, AdvancedControlInstance);
754 774
755#[allow(unused)] 775#[allow(unused)]