Home Alert System
Dependencies: PWM_Tone_Library DHT
mbed/TimerEvent.h@5:569a4894abc1, 2019-03-08 (annotated)
- Committer:
- aziz111
- Date:
- Fri Mar 08 17:15:02 2019 +0000
- Revision:
- 5:569a4894abc1
- Parent:
- 3:78f223d34f36
Final
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ethaderu | 3:78f223d34f36 | 1 | /* mbed Microcontroller Library |
ethaderu | 3:78f223d34f36 | 2 | * Copyright (c) 2006-2013 ARM Limited |
ethaderu | 3:78f223d34f36 | 3 | * |
ethaderu | 3:78f223d34f36 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
ethaderu | 3:78f223d34f36 | 5 | * you may not use this file except in compliance with the License. |
ethaderu | 3:78f223d34f36 | 6 | * You may obtain a copy of the License at |
ethaderu | 3:78f223d34f36 | 7 | * |
ethaderu | 3:78f223d34f36 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
ethaderu | 3:78f223d34f36 | 9 | * |
ethaderu | 3:78f223d34f36 | 10 | * Unless required by applicable law or agreed to in writing, software |
ethaderu | 3:78f223d34f36 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
ethaderu | 3:78f223d34f36 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ethaderu | 3:78f223d34f36 | 13 | * See the License for the specific language governing permissions and |
ethaderu | 3:78f223d34f36 | 14 | * limitations under the License. |
ethaderu | 3:78f223d34f36 | 15 | */ |
ethaderu | 3:78f223d34f36 | 16 | #ifndef MBED_TIMEREVENT_H |
ethaderu | 3:78f223d34f36 | 17 | #define MBED_TIMEREVENT_H |
ethaderu | 3:78f223d34f36 | 18 | |
ethaderu | 3:78f223d34f36 | 19 | #include "ticker_api.h" |
ethaderu | 3:78f223d34f36 | 20 | #include "us_ticker_api.h" |
ethaderu | 3:78f223d34f36 | 21 | |
ethaderu | 3:78f223d34f36 | 22 | namespace mbed { |
ethaderu | 3:78f223d34f36 | 23 | |
ethaderu | 3:78f223d34f36 | 24 | /** Base abstraction for timer interrupts |
ethaderu | 3:78f223d34f36 | 25 | */ |
ethaderu | 3:78f223d34f36 | 26 | class TimerEvent { |
ethaderu | 3:78f223d34f36 | 27 | public: |
ethaderu | 3:78f223d34f36 | 28 | TimerEvent(); |
ethaderu | 3:78f223d34f36 | 29 | TimerEvent(const ticker_data_t *data); |
ethaderu | 3:78f223d34f36 | 30 | |
ethaderu | 3:78f223d34f36 | 31 | /** The handler registered with the underlying timer interrupt |
ethaderu | 3:78f223d34f36 | 32 | */ |
ethaderu | 3:78f223d34f36 | 33 | static void irq(uint32_t id); |
ethaderu | 3:78f223d34f36 | 34 | |
ethaderu | 3:78f223d34f36 | 35 | /** Destruction removes it... |
ethaderu | 3:78f223d34f36 | 36 | */ |
ethaderu | 3:78f223d34f36 | 37 | virtual ~TimerEvent(); |
ethaderu | 3:78f223d34f36 | 38 | |
ethaderu | 3:78f223d34f36 | 39 | protected: |
ethaderu | 3:78f223d34f36 | 40 | // The handler called to service the timer event of the derived class |
ethaderu | 3:78f223d34f36 | 41 | virtual void handler() = 0; |
ethaderu | 3:78f223d34f36 | 42 | |
ethaderu | 3:78f223d34f36 | 43 | // insert in to linked list |
ethaderu | 3:78f223d34f36 | 44 | void insert(timestamp_t timestamp); |
ethaderu | 3:78f223d34f36 | 45 | |
ethaderu | 3:78f223d34f36 | 46 | // remove from linked list, if in it |
ethaderu | 3:78f223d34f36 | 47 | void remove(); |
ethaderu | 3:78f223d34f36 | 48 | |
ethaderu | 3:78f223d34f36 | 49 | ticker_event_t event; |
ethaderu | 3:78f223d34f36 | 50 | |
ethaderu | 3:78f223d34f36 | 51 | const ticker_data_t *_ticker_data; |
ethaderu | 3:78f223d34f36 | 52 | }; |
ethaderu | 3:78f223d34f36 | 53 | |
ethaderu | 3:78f223d34f36 | 54 | } // namespace mbed |
ethaderu | 3:78f223d34f36 | 55 | |
ethaderu | 3:78f223d34f36 | 56 | #endif |