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