Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
DeepSleepLock.h
00001 /* mbed Microcontroller Library 00002 * Copyright (c) 2017-2019 ARM Limited 00003 * SPDX-License-Identifier: Apache-2.0 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 #ifndef MBED_DEEPSLEEPLOCK_H 00018 #define MBED_DEEPSLEEPLOCK_H 00019 00020 #include <limits.h> 00021 #include <stdint.h> 00022 00023 namespace mbed { 00024 /** \addtogroup platform-public-api */ 00025 /** @{*/ 00026 /** 00027 * \defgroup platform_DeepSleepLock DeepSleepLock functions 00028 * @{ 00029 */ 00030 00031 /** RAII object for disabling, then restoring the deep sleep mode 00032 * Usage: 00033 * @code 00034 * 00035 * void f() { 00036 * // some code here 00037 * { 00038 * DeepSleepLock lock; 00039 * // Code in this block will run with the deep sleep mode locked 00040 * } 00041 * // deep sleep mode will be restored to their previous state 00042 * } 00043 * @endcode 00044 */ 00045 class DeepSleepLock { 00046 private: 00047 uint16_t _lock_count; 00048 00049 public: 00050 DeepSleepLock(); 00051 00052 ~DeepSleepLock(); 00053 00054 /** Mark the start of a locked deep sleep section 00055 */ 00056 void lock(); 00057 00058 /** Mark the end of a locked deep sleep section 00059 */ 00060 void unlock(); 00061 }; 00062 00063 /**@}*/ 00064 00065 /**@}*/ 00066 00067 00068 } 00069 00070 #endif
Generated on Tue Jul 12 2022 13:54:16 by
1.7.2