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