Mistake on this page?
Report an issue in GitHub or email us
TimerEvent.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2006-2013 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 "hal/us_ticker_api.h"
22 #include "platform/NonCopyable.h"
23 
24 namespace mbed {
25 /** \addtogroup drivers */
26 
27 /** Base abstraction for timer interrupts
28  *
29  * @note Synchronization level: Interrupt safe
30  * @ingroup drivers
31  */
32 class TimerEvent : private NonCopyable<TimerEvent> {
33 public:
34  TimerEvent();
35  TimerEvent(const ticker_data_t *data);
36 
37  /** The handler registered with the underlying timer interrupt
38  *
39  * @param id Timer Event ID
40  */
41  static void irq(uint32_t id);
42 
43  /** Destruction removes it...
44  */
45  virtual ~TimerEvent();
46 
47 #if !defined(DOXYGEN_ONLY)
48 protected:
49  // The handler called to service the timer event of the derived class
50  virtual void handler() = 0;
51 
52  /** Set relative timestamp of the internal event.
53  * @param timestamp event's us timestamp
54  *
55  * @warning
56  * Do not insert more than one timestamp.
57  * The same @a event object is used for every @a insert/insert_absolute call.
58  *
59  * @warning
60  * Ticker's present timestamp is used for reference. For timestamps
61  * from the past the event is scheduled after ticker's overflow.
62  * For reference @see convert_timestamp
63  */
64  void insert(timestamp_t timestamp);
65 
66  /** Set absolute timestamp of the internal event.
67  * @param timestamp event's us timestamp
68  *
69  * @warning
70  * Do not insert more than one timestamp.
71  * The same @a event object is used for every @a insert/insert_absolute call.
72  */
73  void insert_absolute(us_timestamp_t timestamp);
74 
75  /** Remove timestamp.
76  */
77  void remove();
78 
79  ticker_event_t event;
80 
81  const ticker_data_t *_ticker_data;
82 #endif
83 };
84 
85 } // namespace mbed
86 
87 #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:92
Prevents generation of copy constructor and copy assignment operator in derived classes.
Definition: NonCopyable.h:168
Base abstraction for timer interrupts.
Definition: TimerEvent.h:32
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
Definition: AnalogIn.h:28
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.