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