helpfor studient

Dependents:   STM32_F103-C8T6basecanblink_led

Fork of mbed-dev by mbed official

Committer:
Anna Bridge
Date:
Wed Jan 17 15:23:54 2018 +0000
Revision:
181:96ed750bd169
Parent:
160:d5399cc887bb
mbed-dev libray. Release version 158

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 144:ef7eb2e8f9f7 1 /***************************************************************************//**
<> 144:ef7eb2e8f9f7 2 * @file sleep.c
<> 144:ef7eb2e8f9f7 3 *******************************************************************************
<> 144:ef7eb2e8f9f7 4 * @section License
<> 144:ef7eb2e8f9f7 5 * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b>
<> 144:ef7eb2e8f9f7 6 *******************************************************************************
<> 144:ef7eb2e8f9f7 7 *
<> 144:ef7eb2e8f9f7 8 * SPDX-License-Identifier: Apache-2.0
<> 144:ef7eb2e8f9f7 9 *
<> 144:ef7eb2e8f9f7 10 * Licensed under the Apache License, Version 2.0 (the "License"); you may
<> 144:ef7eb2e8f9f7 11 * not use this file except in compliance with the License.
<> 144:ef7eb2e8f9f7 12 * You may obtain a copy of the License at
<> 144:ef7eb2e8f9f7 13 *
<> 144:ef7eb2e8f9f7 14 * http://www.apache.org/licenses/LICENSE-2.0
<> 144:ef7eb2e8f9f7 15 *
<> 144:ef7eb2e8f9f7 16 * Unless required by applicable law or agreed to in writing, software
<> 144:ef7eb2e8f9f7 17 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
<> 144:ef7eb2e8f9f7 18 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 144:ef7eb2e8f9f7 19 * See the License for the specific language governing permissions and
<> 144:ef7eb2e8f9f7 20 * limitations under the License.
<> 144:ef7eb2e8f9f7 21 *
<> 144:ef7eb2e8f9f7 22 ******************************************************************************/
<> 144:ef7eb2e8f9f7 23
<> 144:ef7eb2e8f9f7 24 #include "device.h"
<> 144:ef7eb2e8f9f7 25 #if DEVICE_SLEEP
<> 144:ef7eb2e8f9f7 26
<> 144:ef7eb2e8f9f7 27 #include "sleep_api.h"
<> 144:ef7eb2e8f9f7 28 #include "em_emu.h"
<> 144:ef7eb2e8f9f7 29
<> 144:ef7eb2e8f9f7 30 /**
<> 144:ef7eb2e8f9f7 31 * Sleep mode.
Anna Bridge 181:96ed750bd169 32 * Stop the core clock using a WFI.
<> 144:ef7eb2e8f9f7 33 */
<> 160:d5399cc887bb 34 void hal_sleep(void)
<> 144:ef7eb2e8f9f7 35 {
Anna Bridge 181:96ed750bd169 36 EMU_EnterEM1();
<> 144:ef7eb2e8f9f7 37 }
<> 144:ef7eb2e8f9f7 38
<> 144:ef7eb2e8f9f7 39 /**
<> 144:ef7eb2e8f9f7 40 * Deep Sleep mode.
<> 144:ef7eb2e8f9f7 41 * Enter Energy Mode 2, turning off all high-frequency clocks.
<> 144:ef7eb2e8f9f7 42 *
<> 144:ef7eb2e8f9f7 43 * In EM2 the high frequency oscillator is turned off, but with the 32.768 kHz
<> 144:ef7eb2e8f9f7 44 * oscillator running, selected low energy peripherals (LCD, RTC, LETIMER,
<> 144:ef7eb2e8f9f7 45 * PCNT, LEUART, I2C, LESENSE, OPAMP, USB, WDOG and ACMP) are still
<> 144:ef7eb2e8f9f7 46 * available. This gives a high degree of autonomous operation with a current
<> 144:ef7eb2e8f9f7 47 * consumption as low as 1.1 μA with RTC enabled. Power-on Reset, Brown-out
<> 144:ef7eb2e8f9f7 48 * Detection and full RAM and CPU retention is also included.
<> 144:ef7eb2e8f9f7 49 */
<> 160:d5399cc887bb 50 void hal_deepsleep(void)
<> 144:ef7eb2e8f9f7 51 {
<> 144:ef7eb2e8f9f7 52 EMU_EnterEM2(true);
<> 144:ef7eb2e8f9f7 53 }
<> 144:ef7eb2e8f9f7 54
<> 144:ef7eb2e8f9f7 55 #endif