@@ -90,6 +90,25 @@ typedef enum {
90
90
PERCENT_COMPARE_FORMAT, // used for Dutycycle
91
91
} TimerCompareFormat_t;
92
92
93
+ typedef enum {
94
+ FILTER_NONE = 0 , // No filter
95
+ FILTER_CKINT_N2, // Sampling rate is same as clock interrupt, n=2 events
96
+ FILTER_CKINT_N4, // Sampling rate is same as clock interrupt, n=4 events
97
+ FILTER_CKINT_N8, // Sampling rate is same as clock interrupt, n=8 events
98
+ FILTER_DTS2_N6, // Sampling rate is DTS/2, n=6 events
99
+ FILTER_DTS2_N8, // Sampling rate is DTS/2, n=8 events
100
+ FILTER_DTS4_N6, // Sampling rate is DTS/4, n=6 events
101
+ FILTER_DTS4_N8, // Sampling rate is DTS/4, n=8 events
102
+ FILTER_DTS8_N6, // Sampling rate is DTS/8, n=6 events
103
+ FILTER_DTS8_N8, // Sampling rate is DTS/8, n=8 events
104
+ FILTER_DTS16_N5, // Sampling rate is DTS/16, n=5 events
105
+ FILTER_DTS16_N6, // Sampling rate is DTS/16, n=6 events
106
+ FILTER_DTS16_N8, // Sampling rate is DTS/16, n=8 events
107
+ FILTER_DTS32_N5, // Sampling rate is DTS/32, n=5 events
108
+ FILTER_DTS32_N6, // Sampling rate is DTS/32, n=6 events
109
+ FILTER_DTS32_N8, // Sampling rate is DTS/32, n=8 events
110
+ } ChannelInputFilter_t;
111
+
93
112
#ifdef __cplusplus
94
113
95
114
#include < functional>
@@ -121,8 +140,8 @@ class HardwareTimer {
121
140
void setCount (uint32_t val, TimerFormat_t format = TICK_FORMAT); // set timer counter to value 'val' depending on format provided
122
141
uint32_t getCount (TimerFormat_t format = TICK_FORMAT); // return current counter value of timer depending on format provided
123
142
124
- void setMode (uint32_t channel, TimerModes_t mode, PinName pin = NC); // Configure timer channel with specified mode on specified pin if available
125
- void setMode (uint32_t channel, TimerModes_t mode, uint32_t pin);
143
+ void setMode (uint32_t channel, TimerModes_t mode, PinName pin = NC, ChannelInputFilter_t filter = FILTER_NONE ); // Configure timer channel with specified mode on specified pin if available
144
+ void setMode (uint32_t channel, TimerModes_t mode, uint32_t pin, ChannelInputFilter_t filter = FILTER_NONE );
126
145
127
146
TimerModes_t getMode (uint32_t channel); // Retrieve configured mode
128
147
0 commit comments