Only enable HSRUN mode if the reset button is not pressed upon startup.

This commit is contained in:
László Monda
2017-04-30 22:50:53 +02:00
parent a1a3a052dd
commit 151925337e
+3
View File
@@ -1,6 +1,7 @@
#include "fsl_smc.h" #include "fsl_smc.h"
#include "init_clock.h" #include "init_clock.h"
#include "fsl_rtc.h" #include "fsl_rtc.h"
#include "peripherals/reset_button.h"
// How to setup clock using clock driver functions: // How to setup clock using clock driver functions:
// //
@@ -115,10 +116,12 @@ void InitClock(void)
{ {
// Set HSRUN power mode. // Set HSRUN power mode.
SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll); SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll);
if (!RESET_BUTTON_IS_PRESSED) {
SMC_SetPowerModeHsrun(SMC); SMC_SetPowerModeHsrun(SMC);
while (SMC_GetPowerModeState(SMC) != kSMC_PowerStateHsrun) while (SMC_GetPowerModeState(SMC) != kSMC_PowerStateHsrun)
{ {
} }
}
// Set the system clock dividers in SIM to safe value. // Set the system clock dividers in SIM to safe value.
CLOCK_SetSimSafeDivs(); CLOCK_SetSimSafeDivs();
// Configure RTC clock including enabling RTC oscillator. // Configure RTC clock including enabling RTC oscillator.