Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
TimerEvent.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2006-2013 ARM Limited 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 */ 00016 #ifndef MBED_TIMEREVENT_H 00017 #define MBED_TIMEREVENT_H 00018 00019 #include "hal/ticker_api.h" 00020 #include "hal/us_ticker_api.h" 00021 #include "platform/NonCopyable.h" 00022 00023 namespace mbed { 00024 /** \addtogroup drivers */ 00025 00026 /** Base abstraction for timer interrupts 00027 * 00028 * @note Synchronization level: Interrupt safe 00029 * @ingroup drivers 00030 */ 00031 class TimerEvent : private NonCopyable<TimerEvent> { 00032 public: 00033 TimerEvent(); 00034 TimerEvent(const ticker_data_t *data); 00035 00036 /** The handler registered with the underlying timer interrupt 00037 * 00038 * @param id Timer Event ID 00039 */ 00040 static void irq(uint32_t id); 00041 00042 /** Destruction removes it... 00043 */ 00044 virtual ~TimerEvent(); 00045 00046 protected: 00047 // The handler called to service the timer event of the derived class 00048 virtual void handler() = 0; 00049 00050 /** Set relative timestamp of the internal event. 00051 * @param timestamp event's us timestamp 00052 * 00053 * @warning 00054 * Do not insert more than one timestamp. 00055 * The same @a event object is used for every @a insert/insert_absolute call. 00056 * 00057 * @warning 00058 * Ticker's present timestamp is used for reference. For timestamps 00059 * from the past the event is scheduled after ticker's overflow. 00060 * For reference @see convert_timestamp 00061 */ 00062 void insert(timestamp_t timestamp); 00063 00064 /** Set absolute timestamp of the internal event. 00065 * @param timestamp event's us timestamp 00066 * 00067 * @warning 00068 * Do not insert more than one timestamp. 00069 * The same @a event object is used for every @a insert/insert_absolute call. 00070 */ 00071 void insert_absolute(us_timestamp_t timestamp); 00072 00073 /** Remove timestamp. 00074 */ 00075 void remove(); 00076 00077 ticker_event_t event; 00078 00079 const ticker_data_t *_ticker_data; 00080 }; 00081 00082 } // namespace mbed 00083 00084 #endif
Generated on Tue Jul 12 2022 14:25:04 by
