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


