mbed library sources

Fork of mbed-src by mbed official

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers sleep_api.h Source File

sleep_api.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef MBED_SLEEP_API_H
00017 #define MBED_SLEEP_API_H
00018 
00019 #include "device.h"
00020 
00021 #if DEVICE_SLEEP
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 /** Send the microcontroller to sleep
00028  *
00029  * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
00030  * system clock to the core is stopped until a reset or an interrupt occurs. This eliminates
00031  * dynamic power used by the processor, memory systems and buses. The processor, peripheral and
00032  * memory state are maintained, and the peripherals continue to work and can generate interrupts.
00033  *
00034  * The processor can be woken up by any internal peripheral interrupt or external pin interrupt.
00035  *
00036  * @note
00037  *  The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
00038  * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
00039  * able to access the LocalFileSystem
00040  */
00041 void sleep(void);
00042 
00043 /** Send the microcontroller to deep sleep
00044  *
00045  * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
00046  * has the same sleep features as sleep plus it powers down peripherals and clocks. All state
00047  * is still maintained.
00048  *
00049  * The processor can only be woken up by an external interrupt on a pin or a watchdog timer.
00050  *
00051  * @note
00052  *  The mbed interface semihosting is disconnected as part of going to sleep, and can not be restored.
00053  * Flash re-programming and the USB serial port will remain active, but the mbed program will no longer be
00054  * able to access the LocalFileSystem
00055  */
00056 void deepsleep(void);
00057 
00058 #ifdef __cplusplus
00059 }
00060 #endif
00061 
00062 #endif
00063 
00064 #endif