Skip to content

Commit 32b6654

Browse files
authored
Merge pull request #2572 from fpistm/HT_FIX
fix(hardwaretimer): avoid glitch when PWM configuration changed
2 parents 339e2b9 + 6c30d95 commit 32b6654

File tree

3 files changed

+96
-100
lines changed

3 files changed

+96
-100
lines changed

keywords.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -862,8 +862,7 @@ GPIO_PIN_14 LITERAL1
862862
GPIO_PIN_15 LITERAL1
863863

864864
# HardwareTimer
865-
TIMER_DISABLED LITERAL1
866-
TIMER_OUTPUT_COMPARE LITERAL1
865+
TIMER_OUTPUT_DISABLED LITERAL1
867866
TIMER_OUTPUT_COMPARE_ACTIVE LITERAL1
868867
TIMER_OUTPUT_COMPARE_INACTIVE LITERAL1
869868
TIMER_OUTPUT_COMPARE_TOGGLE LITERAL1

libraries/SrcWrapper/inc/HardwareTimer.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@
3636
#define TIMER_CHANNELS 4 // channel5 and channel 6 are not considered here has they don't have gpio output and they don't have interrupt
3737

3838
typedef enum {
39-
TIMER_DISABLED, // == TIM_OCMODE_TIMING no output, useful for only-interrupt
39+
TIMER_OUTPUT_DISABLED, // == TIM_OCMODE_TIMING no output, useful for only-interrupt
4040
// Output Compare
41-
TIMER_OUTPUT_COMPARE, // == Obsolete, use TIMER_DISABLED instead. Kept for compatibility reason
4241
TIMER_OUTPUT_COMPARE_ACTIVE, // == TIM_OCMODE_ACTIVE pin is set high when counter == channel compare
4342
TIMER_OUTPUT_COMPARE_INACTIVE, // == TIM_OCMODE_INACTIVE pin is set low when counter == channel compare
4443
TIMER_OUTPUT_COMPARE_TOGGLE, // == TIM_OCMODE_TOGGLE pin toggles when counter == channel compare
@@ -60,6 +59,10 @@ typedef enum {
6059
TIMER_NOT_USED = 0xFFFF // This must be the last item of this enum
6160
} TimerModes_t;
6261

62+
// Backward compatibility
63+
#define TIMER_DISABLED TIMER_OUTPUT_DISABLED
64+
#define TIMER_OUTPUT_COMPARE TIMER_OUTPUT_DISABLED
65+
6366
typedef enum {
6467
TICK_FORMAT, // default
6568
MICROSEC_FORMAT,
@@ -177,10 +180,10 @@ class HardwareTimer {
177180

178181
// The following function(s) are available for more advanced timer options
179182
TIM_HandleTypeDef *getHandle(); // return the handle address for HAL related configuration
180-
int getChannel(uint32_t channel);
181-
int getLLChannel(uint32_t channel);
182-
int getIT(uint32_t channel);
183-
int getAssociatedChannel(uint32_t channel);
183+
uint32_t getChannel(uint32_t channel);
184+
uint32_t getLLChannel(uint32_t channel);
185+
uint32_t getIT(uint32_t channel);
186+
uint32_t getAssociatedChannel(uint32_t channel);
184187

185188
private:
186189
// Store for each channel if regular, complementary or both are used

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy