mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Fri Jul 17 09:15:10 2015 +0100
Revision:
592:a274ee790e56
Synchronized with git revision e7144f83a8d75df80c4877936b6ffe552b0be9e6

Full URL: https://github.com/mbedmicro/mbed/commit/e7144f83a8d75df80c4877936b6ffe552b0be9e6/

More API implementation for SAMR21

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 592:a274ee790e56 1 /* mbed Microcontroller Library
mbed_official 592:a274ee790e56 2 * Copyright (c) 2006-2013 ARM Limited
mbed_official 592:a274ee790e56 3 *
mbed_official 592:a274ee790e56 4 * Licensed under the Apache License, Version 2.0 (the "License");
mbed_official 592:a274ee790e56 5 * you may not use this file except in compliance with the License.
mbed_official 592:a274ee790e56 6 * You may obtain a copy of the License at
mbed_official 592:a274ee790e56 7 *
mbed_official 592:a274ee790e56 8 * http://www.apache.org/licenses/LICENSE-2.0
mbed_official 592:a274ee790e56 9 *
mbed_official 592:a274ee790e56 10 * Unless required by applicable law or agreed to in writing, software
mbed_official 592:a274ee790e56 11 * distributed under the License is distributed on an "AS IS" BASIS,
mbed_official 592:a274ee790e56 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mbed_official 592:a274ee790e56 13 * See the License for the specific language governing permissions and
mbed_official 592:a274ee790e56 14 * limitations under the License.
mbed_official 592:a274ee790e56 15 */
mbed_official 592:a274ee790e56 16 #include "mbed_assert.h"
mbed_official 592:a274ee790e56 17 #include "sleep_api.h"
mbed_official 592:a274ee790e56 18
mbed_official 592:a274ee790e56 19 #include <math.h>
mbed_official 592:a274ee790e56 20
mbed_official 592:a274ee790e56 21 #include "cmsis.h"
mbed_official 592:a274ee790e56 22 #include "power.h"
mbed_official 592:a274ee790e56 23
mbed_official 592:a274ee790e56 24 /** Send the device to sleep
mbed_official 592:a274ee790e56 25 *
mbed_official 592:a274ee790e56 26 * The processor is setup ready for sleep, and sent to sleep using __WFI(). In this mode, the
mbed_official 592:a274ee790e56 27 * system clock to the core is stopped until a reset or an interrupt occurs.
mbed_official 592:a274ee790e56 28 * @param[void] void
mbed_official 592:a274ee790e56 29 * @return void
mbed_official 592:a274ee790e56 30 */
mbed_official 592:a274ee790e56 31 void sleep(void)
mbed_official 592:a274ee790e56 32 {
mbed_official 592:a274ee790e56 33 system_set_sleepmode(SYSTEM_SLEEPMODE_IDLE_2);
mbed_official 592:a274ee790e56 34 system_sleep();
mbed_official 592:a274ee790e56 35 }
mbed_official 592:a274ee790e56 36
mbed_official 592:a274ee790e56 37 /** Send the device to deep sleep
mbed_official 592:a274ee790e56 38 *
mbed_official 592:a274ee790e56 39 * This processor is setup ready for deep sleep, and sent to sleep using __WFI(). This mode
mbed_official 592:a274ee790e56 40 * has the same sleep features as sleep plus it powers down peripherals and clocks. All state
mbed_official 592:a274ee790e56 41 * is still maintained.
mbed_official 592:a274ee790e56 42 * @param[void] void
mbed_official 592:a274ee790e56 43 * @return void
mbed_official 592:a274ee790e56 44 */
mbed_official 592:a274ee790e56 45 void deepsleep(void)
mbed_official 592:a274ee790e56 46 {
mbed_official 592:a274ee790e56 47 system_set_sleepmode(SYSTEM_SLEEPMODE_STANDBY);
mbed_official 592:a274ee790e56 48 system_sleep();
mbed_official 592:a274ee790e56 49 }