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