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