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