Mistake on this page?
Report an issue in GitHub or email us
DeepSleepLock.h
1 /* mbed Microcontroller Library
2  * Copyright (c) 2017-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_DEEPSLEEPLOCK_H
18 #define MBED_DEEPSLEEPLOCK_H
19 
20 #include <limits.h>
21 #include <stdint.h>
22 
23 namespace mbed {
24 /** \addtogroup platform-public-api */
25 /** @{*/
26 /**
27  * \defgroup platform_DeepSleepLock DeepSleepLock functions
28  * @{
29  */
30 
31 /** RAII object for disabling, then restoring the deep sleep mode
32  * Usage:
33  * @code
34  *
35  * void f() {
36  * // some code here
37  * {
38  * DeepSleepLock lock;
39  * // Code in this block will run with the deep sleep mode locked
40  * }
41  * // deep sleep mode will be restored to their previous state
42  * }
43  * @endcode
44  */
46 private:
47  uint16_t _lock_count;
48 
49 public:
50  DeepSleepLock();
51 
52  ~DeepSleepLock();
53 
54  /** Mark the start of a locked deep sleep section
55  */
56  void lock();
57 
58  /** Mark the end of a locked deep sleep section
59  */
60  void unlock();
61 };
62 
63 /**@}*/
64 
65 /**@}*/
66 
67 
68 }
69 
70 #endif
void lock()
Mark the start of a locked deep sleep section.
void unlock()
Mark the end of a locked deep sleep section.
RAII object for disabling, then restoring the deep sleep mode Usage:
Definition: DeepSleepLock.h:45
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.