CDY version that shares functionality with Counter
Dependencies: SDFileSystem_HelloWorld mbed FATFileSystem
mbed/drivers/TimerEvent.h@3:c547dba5d39b, 2018-11-05 (annotated)
- Committer:
- Charles David Young
- Date:
- Mon Nov 05 09:52:17 2018 -0700
- Revision:
- 3:c547dba5d39b
- Parent:
- 0:aa13e1c335cd
debug
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Charles David Young |
0:aa13e1c335cd | 1 | /* mbed Microcontroller Library |
Charles David Young |
0:aa13e1c335cd | 2 | * Copyright (c) 2006-2013 ARM Limited |
Charles David Young |
0:aa13e1c335cd | 3 | * |
Charles David Young |
0:aa13e1c335cd | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
Charles David Young |
0:aa13e1c335cd | 5 | * you may not use this file except in compliance with the License. |
Charles David Young |
0:aa13e1c335cd | 6 | * You may obtain a copy of the License at |
Charles David Young |
0:aa13e1c335cd | 7 | * |
Charles David Young |
0:aa13e1c335cd | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
Charles David Young |
0:aa13e1c335cd | 9 | * |
Charles David Young |
0:aa13e1c335cd | 10 | * Unless required by applicable law or agreed to in writing, software |
Charles David Young |
0:aa13e1c335cd | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
Charles David Young |
0:aa13e1c335cd | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
Charles David Young |
0:aa13e1c335cd | 13 | * See the License for the specific language governing permissions and |
Charles David Young |
0:aa13e1c335cd | 14 | * limitations under the License. |
Charles David Young |
0:aa13e1c335cd | 15 | */ |
Charles David Young |
0:aa13e1c335cd | 16 | #ifndef MBED_TIMEREVENT_H |
Charles David Young |
0:aa13e1c335cd | 17 | #define MBED_TIMEREVENT_H |
Charles David Young |
0:aa13e1c335cd | 18 | |
Charles David Young |
0:aa13e1c335cd | 19 | #include "hal/ticker_api.h" |
Charles David Young |
0:aa13e1c335cd | 20 | #include "hal/us_ticker_api.h" |
Charles David Young |
0:aa13e1c335cd | 21 | |
Charles David Young |
0:aa13e1c335cd | 22 | namespace mbed { |
Charles David Young |
0:aa13e1c335cd | 23 | /** \addtogroup drivers */ |
Charles David Young |
0:aa13e1c335cd | 24 | /** @{*/ |
Charles David Young |
0:aa13e1c335cd | 25 | |
Charles David Young |
0:aa13e1c335cd | 26 | /** Base abstraction for timer interrupts |
Charles David Young |
0:aa13e1c335cd | 27 | * |
Charles David Young |
0:aa13e1c335cd | 28 | * @Note Synchronization level: Interrupt safe |
Charles David Young |
0:aa13e1c335cd | 29 | */ |
Charles David Young |
0:aa13e1c335cd | 30 | class TimerEvent { |
Charles David Young |
0:aa13e1c335cd | 31 | public: |
Charles David Young |
0:aa13e1c335cd | 32 | TimerEvent(); |
Charles David Young |
0:aa13e1c335cd | 33 | TimerEvent(const ticker_data_t *data); |
Charles David Young |
0:aa13e1c335cd | 34 | |
Charles David Young |
0:aa13e1c335cd | 35 | /** The handler registered with the underlying timer interrupt |
Charles David Young |
0:aa13e1c335cd | 36 | */ |
Charles David Young |
0:aa13e1c335cd | 37 | static void irq(uint32_t id); |
Charles David Young |
0:aa13e1c335cd | 38 | |
Charles David Young |
0:aa13e1c335cd | 39 | /** Destruction removes it... |
Charles David Young |
0:aa13e1c335cd | 40 | */ |
Charles David Young |
0:aa13e1c335cd | 41 | virtual ~TimerEvent(); |
Charles David Young |
0:aa13e1c335cd | 42 | |
Charles David Young |
0:aa13e1c335cd | 43 | protected: |
Charles David Young |
0:aa13e1c335cd | 44 | // The handler called to service the timer event of the derived class |
Charles David Young |
0:aa13e1c335cd | 45 | virtual void handler() = 0; |
Charles David Young |
0:aa13e1c335cd | 46 | |
Charles David Young |
0:aa13e1c335cd | 47 | // insert in to linked list |
Charles David Young |
0:aa13e1c335cd | 48 | void insert(timestamp_t timestamp); |
Charles David Young |
0:aa13e1c335cd | 49 | |
Charles David Young |
0:aa13e1c335cd | 50 | // remove from linked list, if in it |
Charles David Young |
0:aa13e1c335cd | 51 | void remove(); |
Charles David Young |
0:aa13e1c335cd | 52 | |
Charles David Young |
0:aa13e1c335cd | 53 | ticker_event_t event; |
Charles David Young |
0:aa13e1c335cd | 54 | |
Charles David Young |
0:aa13e1c335cd | 55 | const ticker_data_t *_ticker_data; |
Charles David Young |
0:aa13e1c335cd | 56 | }; |
Charles David Young |
0:aa13e1c335cd | 57 | |
Charles David Young |
0:aa13e1c335cd | 58 | } // namespace mbed |
Charles David Young |
0:aa13e1c335cd | 59 | |
Charles David Young |
0:aa13e1c335cd | 60 | #endif |
Charles David Young |
0:aa13e1c335cd | 61 | |
Charles David Young |
0:aa13e1c335cd | 62 | /** @}*/ |