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