You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/* Class --------------------------------------------------------*/
96
99
classHardwareTimer {
97
100
public:
@@ -109,8 +112,8 @@ class HardwareTimer {
109
112
voidsetOverflow(uint32_t val, TimerFormat_t format = TICK_FORMAT); // set AutoReload register depending on format provided
110
113
uint32_tgetOverflow(TimerFormat_t format = TICK_FORMAT); // return overflow depending on format provided
111
114
112
-
voidsetPWM(uint32_t channel, PinName pin, uint32_t frequency, uint32_t dutycycle, void (*PeriodCallback)(HardwareTimer *) = NULL, void (*CompareCallback)(HardwareTimer *) = NULL); // Set all in one command freq in HZ, Duty in percentage. Including both interrup.
voidsetPWM(uint32_t channel, PinName pin, uint32_t frequency, uint32_t dutycycle, callback_function_tPeriodCallback = nullptr, callback_function_tCompareCallback = nullptr); // Set all in one command freq in HZ, Duty in percentage. Including both interrup.
voidsetCount(uint32_t val, TimerFormat_t format = TICK_FORMAT); // set timer counter to value 'val' depending on format provided
116
119
uint32_tgetCount(TimerFormat_t format = TICK_FORMAT); // return current counter value of timer depending on format provided
@@ -128,14 +131,13 @@ class HardwareTimer {
128
131
voidsetInterruptPriority(uint32_t preemptPriority, uint32_t subPriority); // set interrupt priority
129
132
130
133
//Add interrupt to period update
131
-
voidattachInterrupt(void (*handler)(HardwareTimer *)); // Attach interrupt callback which will be called upon update event (timer rollover)
134
+
voidattachInterrupt(callback_function_t callback); // Attach interrupt callback which will be called upon update event (timer rollover)
132
135
voiddetachInterrupt(); // remove interrupt callback which was attached to update event
133
136
boolhasInterrupt(); //returns true if a timer rollover interrupt has already been set
134
137
//Add interrupt to capture/compare channel
135
-
voidattachInterrupt(uint32_t channel, void (*handler)(HardwareTimer *)); // Attach interrupt callback which will be called upon compare match event of specified channel
138
+
voidattachInterrupt(uint32_t channel, callback_function_t callback); // Attach interrupt callback which will be called upon compare match event of specified channel
136
139
voiddetachInterrupt(uint32_t channel); // remove interrupt callback which was attached to compare match event of specified channel
137
140
boolhasInterrupt(uint32_t channel); //returns true if an interrupt has already been set on the channel compare match
// Refresh() is usefull while timer is running after some registers update
@@ -158,7 +160,7 @@ class HardwareTimer {
158
160
private:
159
161
TimerModes_t _ChannelMode[TIMER_CHANNELS];
160
162
timerObj_t _timerObj;
161
-
void (*callbacks[1 + TIMER_CHANNELS])(HardwareTimer *); //Callbacks: 0 for update, 1-4 for channels. (channel5/channel6, if any, doesn't have interrupt)
163
+
callback_function_tcallbacks[1 + TIMER_CHANNELS]; //Callbacks: 0 for update, 1-4 for channels. (channel5/channel6, if any, doesn't have interrupt)
0 commit comments