Erste version der Software für der Prototyp

Committer:
borlanic
Date:
Fri Mar 30 14:07:05 2018 +0000
Revision:
4:75df35ef4fb6
Parent:
0:380207fcb5c1
commentar

Who changed what in which revision?

UserRevisionLine numberNew contents of line
borlanic 0:380207fcb5c1 1 /* mbed Microcontroller Library
borlanic 0:380207fcb5c1 2 * Copyright (c) 2006-2013 ARM Limited
borlanic 0:380207fcb5c1 3 *
borlanic 0:380207fcb5c1 4 * Licensed under the Apache License, Version 2.0 (the "License");
borlanic 0:380207fcb5c1 5 * you may not use this file except in compliance with the License.
borlanic 0:380207fcb5c1 6 * You may obtain a copy of the License at
borlanic 0:380207fcb5c1 7 *
borlanic 0:380207fcb5c1 8 * http://www.apache.org/licenses/LICENSE-2.0
borlanic 0:380207fcb5c1 9 *
borlanic 0:380207fcb5c1 10 * Unless required by applicable law or agreed to in writing, software
borlanic 0:380207fcb5c1 11 * distributed under the License is distributed on an "AS IS" BASIS,
borlanic 0:380207fcb5c1 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
borlanic 0:380207fcb5c1 13 * See the License for the specific language governing permissions and
borlanic 0:380207fcb5c1 14 * limitations under the License.
borlanic 0:380207fcb5c1 15 */
borlanic 0:380207fcb5c1 16 #ifndef MBED_TIMEREVENT_H
borlanic 0:380207fcb5c1 17 #define MBED_TIMEREVENT_H
borlanic 0:380207fcb5c1 18
borlanic 0:380207fcb5c1 19 #include "hal/ticker_api.h"
borlanic 0:380207fcb5c1 20 #include "hal/us_ticker_api.h"
borlanic 0:380207fcb5c1 21 #include "platform/NonCopyable.h"
borlanic 0:380207fcb5c1 22
borlanic 0:380207fcb5c1 23 namespace mbed {
borlanic 0:380207fcb5c1 24 /** \addtogroup drivers */
borlanic 0:380207fcb5c1 25
borlanic 0:380207fcb5c1 26 /** Base abstraction for timer interrupts
borlanic 0:380207fcb5c1 27 *
borlanic 0:380207fcb5c1 28 * @note Synchronization level: Interrupt safe
borlanic 0:380207fcb5c1 29 * @ingroup drivers
borlanic 0:380207fcb5c1 30 */
borlanic 0:380207fcb5c1 31 class TimerEvent : private NonCopyable<TimerEvent> {
borlanic 0:380207fcb5c1 32 public:
borlanic 0:380207fcb5c1 33 TimerEvent();
borlanic 0:380207fcb5c1 34 TimerEvent(const ticker_data_t *data);
borlanic 0:380207fcb5c1 35
borlanic 0:380207fcb5c1 36 /** The handler registered with the underlying timer interrupt
borlanic 0:380207fcb5c1 37 *
borlanic 0:380207fcb5c1 38 * @param id Timer Event ID
borlanic 0:380207fcb5c1 39 */
borlanic 0:380207fcb5c1 40 static void irq(uint32_t id);
borlanic 0:380207fcb5c1 41
borlanic 0:380207fcb5c1 42 /** Destruction removes it...
borlanic 0:380207fcb5c1 43 */
borlanic 0:380207fcb5c1 44 virtual ~TimerEvent();
borlanic 0:380207fcb5c1 45
borlanic 0:380207fcb5c1 46 protected:
borlanic 0:380207fcb5c1 47 // The handler called to service the timer event of the derived class
borlanic 0:380207fcb5c1 48 virtual void handler() = 0;
borlanic 0:380207fcb5c1 49
borlanic 0:380207fcb5c1 50 /** Set relative timestamp of the internal event.
borlanic 0:380207fcb5c1 51 * @param timestamp event's us timestamp
borlanic 0:380207fcb5c1 52 *
borlanic 0:380207fcb5c1 53 * @warning
borlanic 0:380207fcb5c1 54 * Do not insert more than one timestamp.
borlanic 0:380207fcb5c1 55 * The same @a event object is used for every @a insert/insert_absolute call.
borlanic 0:380207fcb5c1 56 *
borlanic 0:380207fcb5c1 57 * @warning
borlanic 0:380207fcb5c1 58 * Ticker's present timestamp is used for reference. For timestamps
borlanic 0:380207fcb5c1 59 * from the past the event is scheduled after ticker's overflow.
borlanic 0:380207fcb5c1 60 * For reference @see convert_timestamp
borlanic 0:380207fcb5c1 61 */
borlanic 0:380207fcb5c1 62 void insert(timestamp_t timestamp);
borlanic 0:380207fcb5c1 63
borlanic 0:380207fcb5c1 64 /** Set absolute timestamp of the internal event.
borlanic 0:380207fcb5c1 65 * @param timestamp event's us timestamp
borlanic 0:380207fcb5c1 66 *
borlanic 0:380207fcb5c1 67 * @warning
borlanic 0:380207fcb5c1 68 * Do not insert more than one timestamp.
borlanic 0:380207fcb5c1 69 * The same @a event object is used for every @a insert/insert_absolute call.
borlanic 0:380207fcb5c1 70 */
borlanic 0:380207fcb5c1 71 void insert_absolute(us_timestamp_t timestamp);
borlanic 0:380207fcb5c1 72
borlanic 0:380207fcb5c1 73 /** Remove timestamp.
borlanic 0:380207fcb5c1 74 */
borlanic 0:380207fcb5c1 75 void remove();
borlanic 0:380207fcb5c1 76
borlanic 0:380207fcb5c1 77 ticker_event_t event;
borlanic 0:380207fcb5c1 78
borlanic 0:380207fcb5c1 79 const ticker_data_t *_ticker_data;
borlanic 0:380207fcb5c1 80 };
borlanic 0:380207fcb5c1 81
borlanic 0:380207fcb5c1 82 } // namespace mbed
borlanic 0:380207fcb5c1 83
borlanic 0:380207fcb5c1 84 #endif