Mbed OS Reference
Loading...
Searching...
No Matches
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
*/
45
class
DeepSleepLock
{
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
mbed::DeepSleepLock
RAII object for disabling, then restoring the deep sleep mode Usage:
Definition:
DeepSleepLock.h:45
mbed::DeepSleepLock::unlock
void unlock()
Mark the end of a locked deep sleep section.
mbed::DeepSleepLock::lock
void lock()
Mark the start of a locked deep sleep section.
platform
include
platform
DeepSleepLock.h
Generated by
1.9.5