mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
Kojto
Date:
Wed Jul 19 17:31:21 2017 +0100
Revision:
169:e3b6fe271b81
Parent:
160:d5399cc887bb
Child:
186:707f6e361f3e
This updates the lib to the mbed lib v 147

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 154:37f96f9d4de2 1 /* mbed Microcontroller Library
<> 154:37f96f9d4de2 2 * Copyright (c) 2006-2013 ARM Limited
<> 154:37f96f9d4de2 3 *
<> 154:37f96f9d4de2 4 * Licensed under the Apache License, Version 2.0 (the "License");
<> 154:37f96f9d4de2 5 * you may not use this file except in compliance with the License.
<> 154:37f96f9d4de2 6 * You may obtain a copy of the License at
<> 154:37f96f9d4de2 7 *
<> 154:37f96f9d4de2 8 * http://www.apache.org/licenses/LICENSE-2.0
<> 154:37f96f9d4de2 9 *
<> 154:37f96f9d4de2 10 * Unless required by applicable law or agreed to in writing, software
<> 154:37f96f9d4de2 11 * distributed under the License is distributed on an "AS IS" BASIS,
<> 154:37f96f9d4de2 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 154:37f96f9d4de2 13 * See the License for the specific language governing permissions and
<> 154:37f96f9d4de2 14 * limitations under the License.
<> 154:37f96f9d4de2 15 */
<> 154:37f96f9d4de2 16 #include "sleep_api.h"
<> 154:37f96f9d4de2 17 #include "cmsis.h"
<> 154:37f96f9d4de2 18 #include "fsl_smc.h"
<> 154:37f96f9d4de2 19 #include "fsl_clock_config.h"
<> 154:37f96f9d4de2 20
<> 160:d5399cc887bb 21 void hal_sleep(void)
<> 154:37f96f9d4de2 22 {
<> 154:37f96f9d4de2 23 SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll);
<> 154:37f96f9d4de2 24
<> 154:37f96f9d4de2 25 SMC_SetPowerModeWait(SMC);
<> 154:37f96f9d4de2 26 }
<> 154:37f96f9d4de2 27
<> 160:d5399cc887bb 28 void hal_deepsleep(void)
<> 154:37f96f9d4de2 29 {
<> 154:37f96f9d4de2 30 #if (defined(FSL_FEATURE_SOC_MCG_COUNT) && FSL_FEATURE_SOC_MCG_COUNT)
Kojto 169:e3b6fe271b81 31 #if defined(kMCG_ModePEE)
<> 154:37f96f9d4de2 32 mcg_mode_t mode = CLOCK_GetMode();
<> 154:37f96f9d4de2 33 #endif
Kojto 169:e3b6fe271b81 34 #endif
Kojto 169:e3b6fe271b81 35
<> 154:37f96f9d4de2 36 SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll);
<> 154:37f96f9d4de2 37
<> 154:37f96f9d4de2 38 SMC_SetPowerModeVlps(SMC);
<> 154:37f96f9d4de2 39
<> 154:37f96f9d4de2 40 #if (defined(FSL_FEATURE_SOC_MCG_COUNT) && FSL_FEATURE_SOC_MCG_COUNT)
<> 154:37f96f9d4de2 41 /*
<> 154:37f96f9d4de2 42 * If enter stop modes when MCG in PEE mode, then after wakeup, the MCG is in PBE mode,
<> 154:37f96f9d4de2 43 * need to enter PEE mode manually.
<> 154:37f96f9d4de2 44 */
<> 154:37f96f9d4de2 45 #if defined(kMCG_ModePEE)
<> 154:37f96f9d4de2 46 if (mode == kMCG_ModePEE) {
<> 154:37f96f9d4de2 47 BOARD_BootClockRUN();
<> 154:37f96f9d4de2 48 }
<> 154:37f96f9d4de2 49 #endif
<> 154:37f96f9d4de2 50 #endif
<> 154:37f96f9d4de2 51 }