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.
mbed-dev/hal/sleep_api.h@1:d0dfbce63a89, 2017-02-24 (annotated)
- Committer:
- elmot
- Date:
- Fri Feb 24 21:13:56 2017 +0000
- Revision:
- 1:d0dfbce63a89
Ready-to-copy
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| elmot | 1:d0dfbce63a89 | 1 | |
| elmot | 1:d0dfbce63a89 | 2 | /** \addtogroup hal */ | 
| elmot | 1:d0dfbce63a89 | 3 | /** @{*/ | 
| elmot | 1:d0dfbce63a89 | 4 | /* mbed Microcontroller Library | 
| elmot | 1:d0dfbce63a89 | 5 | * Copyright (c) 2006-2013 ARM Limited | 
| elmot | 1:d0dfbce63a89 | 6 | * | 
| elmot | 1:d0dfbce63a89 | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); | 
| elmot | 1:d0dfbce63a89 | 8 | * you may not use this file except in compliance with the License. | 
| elmot | 1:d0dfbce63a89 | 9 | * You may obtain a copy of the License at | 
| elmot | 1:d0dfbce63a89 | 10 | * | 
| elmot | 1:d0dfbce63a89 | 11 | * http://www.apache.org/licenses/LICENSE-2.0 | 
| elmot | 1:d0dfbce63a89 | 12 | * | 
| elmot | 1:d0dfbce63a89 | 13 | * Unless required by applicable law or agreed to in writing, software | 
| elmot | 1:d0dfbce63a89 | 14 | * distributed under the License is distributed on an "AS IS" BASIS, | 
| elmot | 1:d0dfbce63a89 | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 
| elmot | 1:d0dfbce63a89 | 16 | * See the License for the specific language governing permissions and | 
| elmot | 1:d0dfbce63a89 | 17 | * limitations under the License. | 
| elmot | 1:d0dfbce63a89 | 18 | */ | 
| elmot | 1:d0dfbce63a89 | 19 | #ifndef MBED_SLEEP_API_H | 
| elmot | 1:d0dfbce63a89 | 20 | #define MBED_SLEEP_API_H | 
| elmot | 1:d0dfbce63a89 | 21 | |
| elmot | 1:d0dfbce63a89 | 22 | #include "device.h" | 
| elmot | 1:d0dfbce63a89 | 23 | |
| elmot | 1:d0dfbce63a89 | 24 | #if DEVICE_SLEEP | 
| elmot | 1:d0dfbce63a89 | 25 | |
| elmot | 1:d0dfbce63a89 | 26 | #ifdef __cplusplus | 
| elmot | 1:d0dfbce63a89 | 27 | extern "C" { | 
| elmot | 1:d0dfbce63a89 | 28 | #endif | 
| elmot | 1:d0dfbce63a89 | 29 | |
| elmot | 1:d0dfbce63a89 | 30 | /** Send the microcontroller to sleep | 
| elmot | 1:d0dfbce63a89 | 31 | * | 
| elmot | 1:d0dfbce63a89 | 32 | * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the | 
| elmot | 1:d0dfbce63a89 | 33 | * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates | 
| elmot | 1:d0dfbce63a89 | 34 | * dynamic power used by the processor, memory systems and buses. The processor, peripheral and | 
| elmot | 1:d0dfbce63a89 | 35 | * memory state are maintained, and the peripherals continue to work and can generate interrupts. | 
| elmot | 1:d0dfbce63a89 | 36 | * | 
| elmot | 1:d0dfbce63a89 | 37 | * The processor can be woken up by any internal peripheral interrupt or external pin interrupt. | 
| elmot | 1:d0dfbce63a89 | 38 | * | 
| elmot | 1:d0dfbce63a89 | 39 | * @note | 
| elmot | 1:d0dfbce63a89 | 40 | * The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. | 
| elmot | 1:d0dfbce63a89 | 41 | * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be | 
| elmot | 1:d0dfbce63a89 | 42 | * able to access the LocalFileSystem | 
| elmot | 1:d0dfbce63a89 | 43 | */ | 
| elmot | 1:d0dfbce63a89 | 44 | void sleep(void); | 
| elmot | 1:d0dfbce63a89 | 45 | |
| elmot | 1:d0dfbce63a89 | 46 | /** Send the microcontroller to deep sleep | 
| elmot | 1:d0dfbce63a89 | 47 | * | 
| elmot | 1:d0dfbce63a89 | 48 | * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode | 
| elmot | 1:d0dfbce63a89 | 49 | * has the same sleep features as sleep plus it powers down peripherals and clocks. All state | 
| elmot | 1:d0dfbce63a89 | 50 | * is still maintained. | 
| elmot | 1:d0dfbce63a89 | 51 | * | 
| elmot | 1:d0dfbce63a89 | 52 | * The processor can only be woken up by an external interrupt on a pin or a watchdog timer. | 
| elmot | 1:d0dfbce63a89 | 53 | * | 
| elmot | 1:d0dfbce63a89 | 54 | * @note | 
| elmot | 1:d0dfbce63a89 | 55 | * The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored. | 
| elmot | 1:d0dfbce63a89 | 56 | * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be | 
| elmot | 1:d0dfbce63a89 | 57 | * able to access the LocalFileSystem | 
| elmot | 1:d0dfbce63a89 | 58 | */ | 
| elmot | 1:d0dfbce63a89 | 59 | void deepsleep(void); | 
| elmot | 1:d0dfbce63a89 | 60 | |
| elmot | 1:d0dfbce63a89 | 61 | #ifdef __cplusplus | 
| elmot | 1:d0dfbce63a89 | 62 | } | 
| elmot | 1:d0dfbce63a89 | 63 | #endif | 
| elmot | 1:d0dfbce63a89 | 64 | |
| elmot | 1:d0dfbce63a89 | 65 | #endif | 
| elmot | 1:d0dfbce63a89 | 66 | |
| elmot | 1:d0dfbce63a89 | 67 | #endif | 
| elmot | 1:d0dfbce63a89 | 68 | |
| elmot | 1:d0dfbce63a89 | 69 | /** @}*/ |