Mistake on this page?
Report an issue in GitHub or email us
Timeout.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_TIMEOUT_H
18 #define MBED_TIMEOUT_H
19 
20 #include "drivers/Ticker.h"
21 #include "platform/NonCopyable.h"
22 #include "platform/mbed_power_mgmt.h"
23 
24 namespace mbed {
25 /** \addtogroup drivers */
26 
27 /** A Timeout is used to call a function at a point in the future
28  *
29  * You can use as many separate Timeout objects as you require.
30  *
31  * @note Synchronization level: Interrupt safe
32  *
33  * Example:
34  * @code
35  * // Blink until timeout.
36  *
37  * #include "mbed.h"
38  *
39  * Timeout timeout;
40  * DigitalOut led(LED1);
41  *
42  * int on = 1;
43  *
44  * void attimeout() {
45  * on = 0;
46  * }
47  *
48  * int main() {
49  * timeout.attach(&attimeout, 5);
50  * while(on) {
51  * led = !led;
52  * wait(0.2);
53  * }
54  * }
55  * @endcode
56  * @ingroup drivers
57  */
58 class Timeout : public Ticker, private NonCopyable<Timeout> {
59 
60 #if !defined(DOXYGEN_ONLY)
61 protected:
62  virtual void handler();
63 #endif
64 };
65 
66 } // namespace mbed
67 
68 #endif
Prevents generation of copy constructor and copy assignment operator in derived classes.
Definition: NonCopyable.h:168
A Ticker is used to call a function at a recurring interval.
Definition: Ticker.h:67
Definition: AnalogIn.h:28
A Timeout is used to call a function at a point in the future.
Definition: Timeout.h:58
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.