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