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