| 187 | * @brief Class template adding delegate callback method support to the basic CallbackTimer template |
| 188 | */ |
| 189 | template <typename TimerApi> class DelegateCallbackTimer : public CallbackTimer<TimerApi> |
| 190 | { |
| 191 | public: |
| 192 | using typename TimerApi::TickType; |
| 193 | using typename TimerApi::TimeType; |
| 194 | using CallbackTimer<TimerApi>::initializeUs; |
| 195 | using CallbackTimer<TimerApi>::initializeMs; |
| 196 | using CallbackTimer<TimerApi>::setCallback; |
| 197 | |
| 198 | /** @brief Initialise timer in microseconds, with static check |
| 199 | * @tparam microseconds Timer interval in microseconds |
| 200 | * @param delegateFunction Function to call when timer triggers |
| 201 | * @retval ExtendedCallbackTimer& Reference to timer |
| 202 | */ |
| 203 | template <TimeType microseconds> DelegateCallbackTimer& IRAM_ATTR initializeUs(TimerDelegate delegateFunction) |
| 204 | { |
| 205 | setCallback(delegateFunction); |
| 206 | this->template setIntervalUs<microseconds>(); |
| 207 | return *this; |
| 208 | } |
| 209 | |
| 210 | /** @brief Initialise hardware timer in milliseconds, with static check |
| 211 | * @tparam milliseconds Timer interval in milliseconds |
| 212 | * @param delegateFunction Function to call when timer triggers |
| 213 | * @retval ExtendedCallbackTimer& Reference to timer |
| 214 | */ |
| 215 | template <uint32_t milliseconds> DelegateCallbackTimer& IRAM_ATTR initializeMs(TimerDelegate delegateFunction) |
| 216 | { |
| 217 | setCallback(delegateFunction); |
| 218 | this->template setIntervalMs<milliseconds>(); |
| 219 | return *this; |
| 220 | } |
| 221 | |
| 222 | /** @brief Initialise millisecond timer |
| 223 | * @param milliseconds Duration of timer in milliseconds |
| 224 | * @param delegateFunction Function to call when timer triggers |
| 225 | * @note Delegate callback method |
| 226 | */ |
| 227 | DelegateCallbackTimer& initializeMs(uint32_t milliseconds, TimerDelegate delegateFunction) |
| 228 | { |
| 229 | setCallback(delegateFunction); |
| 230 | this->setIntervalMs(milliseconds); |
| 231 | return *this; |
| 232 | } |
| 233 | |
| 234 | /** @brief Initialise microsecond timer |
| 235 | * @param microseconds Duration of timer in milliseconds |
| 236 | * @param delegateFunction Function to call when timer triggers |
| 237 | * @note Delegate callback method |
| 238 | */ |
| 239 | DelegateCallbackTimer& initializeUs(uint32_t microseconds, TimerDelegate delegateFunction) |
| 240 | { |
| 241 | setCallback(delegateFunction); |
| 242 | this->setIntervalUs(microseconds); |
| 243 | return *this; |
| 244 | } |
| 245 | |
| 246 | /** @brief Set timer trigger function using Delegate callback method |
nothing calls this directly
no test coverage detected