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

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.