Embedded Template Library 1.0
Loading...
Searching...
No Matches
callback_timer.h
1/******************************************************************************
2The MIT License(MIT)
3
4Embedded Template Library.
5https://github.com/ETLCPP/etl
6https://www.etlcpp.com
7
8Copyright(c) 2017 John Wellbelove
9
10Permission is hereby granted, free of charge, to any person obtaining a copy
11of this software and associated documentation files(the "Software"), to deal
12in the Software without restriction, including without limitation the rights
13to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
14copies of the Software, and to permit persons to whom the Software is
15furnished to do so, subject to the following conditions :
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
23AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26SOFTWARE.
27******************************************************************************/
28
29#ifndef ETL_CALLBACK_TIMER_INCLUDED
30#define ETL_CALLBACK_TIMER_INCLUDED
31
32#include "platform.h"
33#include "algorithm.h"
34#include "atomic.h"
35#include "delegate.h"
36#include "error_handler.h"
37#include "function.h"
38#include "nullptr.h"
39#include "placement_new.h"
40#include "static_assert.h"
41#include "timer.h"
42
43#include <stdint.h>
44
45#if defined(ETL_IN_UNIT_TEST) && ETL_NOT_USING_STL
46 #define ETL_DISABLE_TIMER_UPDATES ((void)0)
47 #define ETL_ENABLE_TIMER_UPDATES ((void)0)
48 #define ETL_TIMER_UPDATES_ENABLED true
49
50 #undef ETL_CALLBACK_TIMER_USE_ATOMIC_LOCK
51 #undef ETL_CALLBACK_TIMER_USE_INTERRUPT_LOCK
52#else
53 #if !defined(ETL_CALLBACK_TIMER_USE_ATOMIC_LOCK) && !defined(ETL_CALLBACK_TIMER_USE_INTERRUPT_LOCK)
54 #error ETL_CALLBACK_TIMER_USE_ATOMIC_LOCK or ETL_CALLBACK_TIMER_USE_INTERRUPT_LOCK not defined
55 #endif
56
57 #if defined(ETL_CALLBACK_TIMER_USE_ATOMIC_LOCK) && defined(ETL_CALLBACK_TIMER_USE_INTERRUPT_LOCK)
58 #error Only define one of ETL_CALLBACK_TIMER_USE_ATOMIC_LOCK or ETL_CALLBACK_TIMER_USE_INTERRUPT_LOCK
59 #endif
60
61 #if defined(ETL_CALLBACK_TIMER_USE_ATOMIC_LOCK)
62 #define ETL_DISABLE_TIMER_UPDATES (++process_semaphore)
63 #define ETL_ENABLE_TIMER_UPDATES (--process_semaphore)
64 #define ETL_TIMER_UPDATES_ENABLED (process_semaphore.load() == 0)
65 #endif
66#endif
67
68#if defined(ETL_CALLBACK_TIMER_USE_INTERRUPT_LOCK)
69 #if !defined(ETL_CALLBACK_TIMER_DISABLE_INTERRUPTS) || !defined(ETL_CALLBACK_TIMER_ENABLE_INTERRUPTS)
70 #error ETL_CALLBACK_TIMER_DISABLE_INTERRUPTS and/or ETL_CALLBACK_TIMER_ENABLE_INTERRUPTS not defined
71 #endif
72
73 #define ETL_DISABLE_TIMER_UPDATES ETL_CALLBACK_TIMER_DISABLE_INTERRUPTS
74 #define ETL_ENABLE_TIMER_UPDATES ETL_CALLBACK_TIMER_ENABLE_INTERRUPTS
75 #define ETL_TIMER_UPDATES_ENABLED true
76#endif
77
78namespace etl
79{
80 //***************************************************************************
82 //***************************************************************************
84 {
85 public:
86
87 typedef etl::delegate<void(void)> callback_type;
88
89 typedef etl::delegate<void(etl::timer::id::type)> event_callback_type;
90
91 //*******************************************
93 //*******************************************
94 etl::timer::id::type register_timer(void (*p_callback_)(), uint32_t period_, bool repeating_)
95 {
96 etl::timer::id::type id = etl::timer::id::NO_TIMER;
97
98 bool is_space = (registered_timers < MAX_TIMERS);
99
100 if (is_space)
101 {
102 // Search for the free space.
103 for (uint_least8_t i = 0U; i < MAX_TIMERS; ++i)
104 {
105 timer_data& timer = timer_array[i];
106
107 if (timer.id == etl::timer::id::NO_TIMER)
108 {
109 // Create in-place.
110 new (&timer) timer_data(i, p_callback_, period_, repeating_);
111 ++registered_timers;
112 id = i;
113 break;
114 }
115 }
116 }
117
118 return id;
119 }
120
121 //*******************************************
123 //*******************************************
124 etl::timer::id::type register_timer(etl::ifunction<void>& callback_, uint32_t period_, bool repeating_)
125 {
126 etl::timer::id::type id = etl::timer::id::NO_TIMER;
127
128 bool is_space = (registered_timers < MAX_TIMERS);
129
130 if (is_space)
131 {
132 // Search for the free space.
133 for (uint_least8_t i = 0U; i < MAX_TIMERS; ++i)
134 {
135 timer_data& timer = timer_array[i];
136
137 if (timer.id == etl::timer::id::NO_TIMER)
138 {
139 // Create in-place.
140 new (&timer) timer_data(i, callback_, period_, repeating_);
141 ++registered_timers;
142 id = i;
143 break;
144 }
145 }
146 }
147
148 return id;
149 }
150
151 //*******************************************
153 //*******************************************
154#if ETL_USING_CPP11
155 etl::timer::id::type register_timer(callback_type& callback_, uint32_t period_, bool repeating_)
156 {
157 etl::timer::id::type id = etl::timer::id::NO_TIMER;
158
159 bool is_space = (registered_timers < MAX_TIMERS);
160
161 if (is_space)
162 {
163 // Search for the free space.
164 for (uint_least8_t i = 0U; i < MAX_TIMERS; ++i)
165 {
166 timer_data& timer = timer_array[i];
167
168 if (timer.id == etl::timer::id::NO_TIMER)
169 {
170 // Create in-place.
171 new (&timer) timer_data(i, callback_, period_, repeating_);
172 ++registered_timers;
173 id = i;
174 break;
175 }
176 }
177 }
178
179 return id;
180 }
181#endif
182
183 //*******************************************
185 //*******************************************
186 bool unregister_timer(etl::timer::id::type id_)
187 {
188 bool result = false;
189
190 if (id_ != etl::timer::id::NO_TIMER)
191 {
192 timer_data& timer = timer_array[id_];
193
194 if (timer.id != etl::timer::id::NO_TIMER)
195 {
196 if (timer.is_active())
197 {
198 ETL_DISABLE_TIMER_UPDATES;
199 active_list.remove(timer.id, false);
200 remove_callback.call_if(timer.id);
201 ETL_ENABLE_TIMER_UPDATES;
202 }
203
204 // Reset in-place.
205 new (&timer) timer_data();
206 --registered_timers;
207
208 result = true;
209 }
210 }
211
212 return result;
213 }
214
215 //*******************************************
217 //*******************************************
218 void enable(bool state_)
219 {
220 enabled = state_;
221 }
222
223 //*******************************************
225 //*******************************************
226 bool is_running() const
227 {
228 return enabled;
229 }
230
231 //*******************************************
233 //*******************************************
234 void clear()
235 {
236 ETL_DISABLE_TIMER_UPDATES;
237 active_list.clear();
238 ETL_ENABLE_TIMER_UPDATES;
239
240 for (int i = 0; i < MAX_TIMERS; ++i)
241 {
242 ::new (&timer_array[i]) timer_data();
243 }
244
245 registered_timers = 0;
246 }
247
248 //*******************************************
249 // Called by the timer service to indicate the
250 // amount of time that has elapsed since the last successful call to 'tick'.
251 // Returns true if the tick was processed,
252 // false if not.
253 //*******************************************
254 bool tick(uint32_t count)
255 {
256 if (enabled)
257 {
258 if (ETL_TIMER_UPDATES_ENABLED)
259 {
260 // We have something to do?
261 bool has_active = !active_list.empty();
262
263 if (has_active)
264 {
265 while (has_active && (count >= active_list.front().delta))
266 {
267 timer_data& timer = active_list.front();
268
269 count -= timer.delta;
270
271 active_list.remove(timer.id, true);
272 remove_callback.call_if(timer.id);
273
274 if (timer.repeating)
275 {
276 // Reinsert the timer.
277 timer.delta = timer.period;
278 active_list.insert(timer.id);
279 insert_callback.call_if(timer.id);
280 }
281
282 if (timer.p_callback != ETL_NULLPTR)
283 {
284 if (timer.cbk_type == timer_data::C_CALLBACK)
285 {
286 // Call the C callback.
287 reinterpret_cast<void (*)()>(timer.p_callback)();
288 }
289 else if (timer.cbk_type == timer_data::IFUNCTION)
290 {
291 // Call the function wrapper callback.
292 (*reinterpret_cast<etl::ifunction<void>*>(timer.p_callback))();
293 }
294 else if (timer.cbk_type == timer_data::DELEGATE)
295 {
296 // Call the delegate callback.
297 (*reinterpret_cast<callback_type*>(timer.p_callback))();
298 }
299 }
300
301 has_active = !active_list.empty();
302 }
303
304 if (has_active)
305 {
306 // Subtract any remainder from the next due timeout.
307 active_list.front().delta -= count;
308 }
309 }
310
311 return true;
312 }
313 }
314
315 return false;
316 }
317
318 //*******************************************
320 //*******************************************
321 bool start(etl::timer::id::type id_, bool immediate_ = false)
322 {
323 bool result = false;
324
325 // Valid timer id?
326 if (id_ != etl::timer::id::NO_TIMER)
327 {
328 timer_data& timer = timer_array[id_];
329
330 // Registered timer?
331 if (timer.id != etl::timer::id::NO_TIMER)
332 {
333 // Has a valid period.
334 if (timer.period != etl::timer::state::Inactive)
335 {
336 ETL_DISABLE_TIMER_UPDATES;
337 if (timer.is_active())
338 {
339 active_list.remove(timer.id, false);
340 remove_callback.call_if(timer.id);
341 }
342
343 timer.delta = immediate_ ? 0 : timer.period;
344 active_list.insert(timer.id);
345 insert_callback.call_if(timer.id);
346 ETL_ENABLE_TIMER_UPDATES;
347
348 result = true;
349 }
350 }
351 }
352
353 return result;
354 }
355
356 //*******************************************
358 //*******************************************
359 bool stop(etl::timer::id::type id_)
360 {
361 bool result = false;
362
363 // Valid timer id?
364 if (id_ != etl::timer::id::NO_TIMER)
365 {
366 timer_data& timer = timer_array[id_];
367
368 // Registered timer?
369 if (timer.id != etl::timer::id::NO_TIMER)
370 {
371 if (timer.is_active())
372 {
373 ETL_DISABLE_TIMER_UPDATES;
374 active_list.remove(timer.id, false);
375 remove_callback.call_if(timer.id);
376 ETL_ENABLE_TIMER_UPDATES;
377 }
378
379 result = true;
380 }
381 }
382
383 return result;
384 }
385
386 //*******************************************
388 //*******************************************
389 bool set_period(etl::timer::id::type id_, uint32_t period_)
390 {
391 if (stop(id_))
392 {
393 timer_array[id_].period = period_;
394 return true;
395 }
396
397 return false;
398 }
399
400 //*******************************************
402 //*******************************************
403 bool set_mode(etl::timer::id::type id_, bool repeating_)
404 {
405 if (stop(id_))
406 {
407 timer_array[id_].repeating = repeating_;
408 return true;
409 }
410
411 return false;
412 }
413
414 //*******************************************
416 //*******************************************
417 bool has_active_timer() const
418 {
419 return !active_list.empty();
420 }
421
422 //*******************************************
426 //*******************************************
427 uint32_t time_to_next() const
428 {
429 uint32_t delta = static_cast<uint32_t>(etl::timer::interval::No_Active_Interval);
430
431 if (has_active_timer())
432 {
433 delta = active_list.front().delta;
434 }
435
436 return delta;
437 }
438
439 //*******************************************
442 //*******************************************
443 bool is_active(etl::timer::id::type id_) const
444 {
445 // Valid timer id?
446 if (is_valid_timer_id(id_))
447 {
448 if (has_active_timer())
449 {
450 const timer_data& timer = timer_array[id_];
451
452 // Registered timer?
453 if (timer.id != etl::timer::id::NO_TIMER)
454 {
455 return timer.is_active();
456 }
457 }
458 }
459
460 return false;
461 }
462
463 //*******************************************
465 //*******************************************
466 void set_insert_callback(event_callback_type insert_)
467 {
468 insert_callback = insert_;
469 }
470
471 //*******************************************
473 //*******************************************
474 void set_remove_callback(event_callback_type remove_)
475 {
476 remove_callback = remove_;
477 }
478
479 //*******************************************
480 void clear_insert_callback()
481 {
482 insert_callback.clear();
483 }
484
485 //*******************************************
486 void clear_remove_callback()
487 {
488 remove_callback.clear();
489 }
490
491 protected:
492
493 //*************************************************************************
495 struct timer_data
496 {
497 typedef etl::delegate<void(void)> callback_type;
498
499 enum callback_type_id
500 {
501 C_CALLBACK,
502 IFUNCTION,
503 DELEGATE
504 };
505
506 //*******************************************
507 timer_data()
508 : p_callback(ETL_NULLPTR)
509 , period(0)
510 , delta(etl::timer::state::Inactive)
511 , id(etl::timer::id::NO_TIMER)
512 , previous(etl::timer::id::NO_TIMER)
513 , next(etl::timer::id::NO_TIMER)
514 , repeating(true)
515 , cbk_type(IFUNCTION)
516 {
517 }
518
519 //*******************************************
521 //*******************************************
522 timer_data(etl::timer::id::type id_, void (*p_callback_)(), uint32_t period_, bool repeating_)
523 : p_callback(reinterpret_cast<void*>(p_callback_))
524 , period(period_)
525 , delta(etl::timer::state::Inactive)
526 , id(id_)
527 , previous(etl::timer::id::NO_TIMER)
528 , next(etl::timer::id::NO_TIMER)
529 , repeating(repeating_)
530 , cbk_type(C_CALLBACK)
531 {
532 }
533
534 //*******************************************
536 //*******************************************
537 timer_data(etl::timer::id::type id_, etl::ifunction<void>& callback_, uint32_t period_, bool repeating_)
538 : p_callback(reinterpret_cast<void*>(&callback_))
539 , period(period_)
540 , delta(etl::timer::state::Inactive)
541 , id(id_)
542 , previous(etl::timer::id::NO_TIMER)
543 , next(etl::timer::id::NO_TIMER)
544 , repeating(repeating_)
545 , cbk_type(IFUNCTION)
546 {
547 }
548
549 //*******************************************
551 //*******************************************
552 timer_data(etl::timer::id::type id_, callback_type& callback_, uint32_t period_, bool repeating_)
553 : p_callback(reinterpret_cast<void*>(&callback_))
554 , period(period_)
555 , delta(etl::timer::state::Inactive)
556 , id(id_)
557 , previous(etl::timer::id::NO_TIMER)
558 , next(etl::timer::id::NO_TIMER)
559 , repeating(repeating_)
560 , cbk_type(DELEGATE)
561 {
562 }
563
564 //*******************************************
566 //*******************************************
567 bool is_active() const
568 {
569 return delta != etl::timer::state::Inactive;
570 }
571
572 //*******************************************
574 //*******************************************
576 {
577 delta = etl::timer::state::Inactive;
578 }
579
580 void* p_callback;
581 uint32_t period;
582 uint32_t delta;
583 etl::timer::id::type id;
584 uint_least8_t previous;
585 uint_least8_t next;
586 bool repeating;
587 callback_type_id cbk_type;
588
589 private:
590
591 // Disabled.
592 timer_data(const timer_data& other);
593 timer_data& operator=(const timer_data& other);
594 };
595
596 //*******************************************
598 //*******************************************
599 icallback_timer(timer_data* const timer_array_, const uint_least8_t Max_Timers_)
600 : timer_array(timer_array_)
601 , active_list(timer_array_)
602 , enabled(false)
603 ,
604#if defined(ETL_CALLBACK_TIMER_USE_ATOMIC_LOCK)
605 process_semaphore(0)
606 ,
607#endif
608 registered_timers(0)
609 , MAX_TIMERS(Max_Timers_)
610 {
611 }
612
613 private:
614
615 //*******************************************
617 //*******************************************
618 bool is_valid_timer_id(etl::timer::id::type id_) const
619 {
620 return (id_ < MAX_TIMERS);
621 }
622
623 //*************************************************************************
624 class timer_list
625 {
626 public:
627
628 //*******************************
629 timer_list(timer_data* ptimers_)
630 : head(etl::timer::id::NO_TIMER)
631 , tail(etl::timer::id::NO_TIMER)
632 , ptimers(ptimers_)
633 {
634 }
635
636 //*******************************
637 bool empty() const
638 {
639 return head == etl::timer::id::NO_TIMER;
640 }
641
642 //*******************************
643 // Inserts the timer at the correct delta position
644 //*******************************
645 void insert(etl::timer::id::type id_)
646 {
647 timer_data& timer = ptimers[id_];
648
649 if (head == etl::timer::id::NO_TIMER)
650 {
651 // No entries yet.
652 head = id_;
653 tail = id_;
654 timer.previous = etl::timer::id::NO_TIMER;
655 timer.next = etl::timer::id::NO_TIMER;
656 }
657 else
658 {
659 // We already have entries.
660 etl::timer::id::type test_id = begin();
661
662 while (test_id != etl::timer::id::NO_TIMER)
663 {
664 timer_data& test = ptimers[test_id];
665
666 // Find the correct place to insert.
667 if (timer.delta <= test.delta)
668 {
669 if (test.id == head)
670 {
671 head = timer.id;
672 }
673
674 // Insert before test.
675 timer.previous = test.previous;
676 test.previous = timer.id;
677 timer.next = test.id;
678
679 // Adjust the next delta to compensate.
680 test.delta -= timer.delta;
681
682 if (timer.previous != etl::timer::id::NO_TIMER)
683 {
684 ptimers[timer.previous].next = timer.id;
685 }
686 break;
687 }
688 else
689 {
690 timer.delta -= test.delta;
691 }
692
693 test_id = next(test_id);
694 }
695
696 // Reached the end?
697 if (test_id == etl::timer::id::NO_TIMER)
698 {
699 // Tag on to the tail.
700 ptimers[tail].next = timer.id;
701 timer.previous = tail;
702 timer.next = etl::timer::id::NO_TIMER;
703 tail = timer.id;
704 }
705 }
706 }
707
708 //*******************************
709 void remove(etl::timer::id::type id_, bool has_expired)
710 {
711 timer_data& timer = ptimers[id_];
712
713 if (head == id_)
714 {
715 head = timer.next;
716 }
717 else
718 {
719 ptimers[timer.previous].next = timer.next;
720 }
721
722 if (tail == id_)
723 {
724 tail = timer.previous;
725 }
726 else
727 {
728 ptimers[timer.next].previous = timer.previous;
729 }
730
731 if (!has_expired)
732 {
733 // Adjust the next delta.
734 if (timer.next != etl::timer::id::NO_TIMER)
735 {
736 ptimers[timer.next].delta += timer.delta;
737 }
738 }
739
740 timer.previous = etl::timer::id::NO_TIMER;
741 timer.next = etl::timer::id::NO_TIMER;
742 timer.delta = etl::timer::state::Inactive;
743 }
744
745 //*******************************
746 timer_data& front()
747 {
748 return ptimers[head];
749 }
750
751 //*******************************
752 const timer_data& front() const
753 {
754 return ptimers[head];
755 }
756
757 //*******************************
758 etl::timer::id::type begin()
759 {
760 return head;
761 }
762
763 //*******************************
764 etl::timer::id::type next(etl::timer::id::type last)
765 {
766 return ptimers[last].next;
767 }
768
769 //*******************************
770 void clear()
771 {
772 etl::timer::id::type id = begin();
773
774 while (id != etl::timer::id::NO_TIMER)
775 {
776 timer_data& timer = ptimers[id];
777 id = next(id);
778 timer.next = etl::timer::id::NO_TIMER;
779 }
780
781 head = etl::timer::id::NO_TIMER;
782 tail = etl::timer::id::NO_TIMER;
783 }
784
785 private:
786
787 etl::timer::id::type head;
788 etl::timer::id::type tail;
789
790 timer_data* const ptimers;
791 };
792
793 // The array of timer data structures.
794 timer_data* const timer_array;
795
796 // The list of active timers.
797 timer_list active_list;
798
799 volatile bool enabled;
800#if defined(ETL_CALLBACK_TIMER_USE_ATOMIC_LOCK)
801
802 #if defined(ETL_TIMER_SEMAPHORE_TYPE)
803 typedef ETL_TIMER_SEMAPHORE_TYPE timer_semaphore_t;
804 #else
805 #if ETL_HAS_ATOMIC
806 typedef etl::atomic_uint16_t timer_semaphore_t;
807 #else
808 #error No atomic type available
809 #endif
810 #endif
811
812 mutable etl::timer_semaphore_t process_semaphore;
813#endif
814 uint_least8_t registered_timers;
815
816 event_callback_type insert_callback;
817 event_callback_type remove_callback;
818
819 public:
820
821 const uint_least8_t MAX_TIMERS;
822 };
823
824 //***************************************************************************
826 //***************************************************************************
827 template <const uint_least8_t Max_Timers_>
829 {
830 public:
831
832 ETL_STATIC_ASSERT(Max_Timers_ <= 254, "No more than 254 timers are allowed");
833
834 //*******************************************
836 //*******************************************
838 : icallback_timer(timer_array, Max_Timers_)
839 {
840 }
841
842 private:
843
844 timer_data timer_array[Max_Timers_];
845 };
846} // namespace etl
847
848#undef ETL_DISABLE_TIMER_UPDATES
849#undef ETL_ENABLE_TIMER_UPDATES
850#undef ETL_TIMER_UPDATES_ENABLED
851
852#endif
callback_timer()
Constructor.
Definition callback_timer.h:837
Declaration.
Definition delegate_cpp03.h:191
Interface for callback timer.
Definition callback_timer.h:84
bool unregister_timer(etl::timer::id::type id_)
Register a timer.
Definition callback_timer.h:186
bool is_running() const
Get the enable/disable state.
Definition callback_timer.h:226
bool set_period(etl::timer::id::type id_, uint32_t period_)
Sets a timer's period.
Definition callback_timer.h:389
etl::timer::id::type register_timer(void(*p_callback_)(), uint32_t period_, bool repeating_)
Register a timer.
Definition callback_timer.h:94
void set_insert_callback(event_callback_type insert_)
Set a callback when a timer is inserted on list.
Definition callback_timer.h:466
bool start(etl::timer::id::type id_, bool immediate_=false)
Starts a timer.
Definition callback_timer.h:321
bool set_mode(etl::timer::id::type id_, bool repeating_)
Sets a timer's mode.
Definition callback_timer.h:403
uint32_t time_to_next() const
Definition callback_timer.h:427
bool has_active_timer() const
Check if there is an active timer.
Definition callback_timer.h:417
void set_remove_callback(event_callback_type remove_)
Set a callback when a timer is removed from list.
Definition callback_timer.h:474
bool stop(etl::timer::id::type id_)
Stops a timer.
Definition callback_timer.h:359
void enable(bool state_)
Enable/disable the timer.
Definition callback_timer.h:218
etl::timer::id::type register_timer(etl::ifunction< void > &callback_, uint32_t period_, bool repeating_)
Register a timer.
Definition callback_timer.h:124
bool is_active(etl::timer::id::type id_) const
Definition callback_timer.h:443
icallback_timer(timer_data *const timer_array_, const uint_least8_t Max_Timers_)
Constructor.
Definition callback_timer.h:599
void clear()
Clears the timer of data.
Definition callback_timer.h:234
Definition function.h:54
Definition absolute.h:40
The configuration of a timer.
Definition callback_timer.h:496
timer_data(etl::timer::id::type id_, callback_type &callback_, uint32_t period_, bool repeating_)
ETL delegate callback.
Definition callback_timer.h:552
bool is_active() const
Returns true if the timer is active.
Definition callback_timer.h:567
void set_inactive()
Sets the timer to the inactive state.
Definition callback_timer.h:575
timer_data(etl::timer::id::type id_, etl::ifunction< void > &callback_, uint32_t period_, bool repeating_)
ETL function callback.
Definition callback_timer.h:537
timer_data(etl::timer::id::type id_, void(*p_callback_)(), uint32_t period_, bool repeating_)
C function callback.
Definition callback_timer.h:522
Definition timer.h:88
Common definitions for the timer framework.
Definition timer.h:55