From 151925337e0822a3beafbb2a16b213826ca83acd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20Monda?= Date: Sun, 30 Apr 2017 22:50:53 +0200 Subject: [PATCH] Only enable HSRUN mode if the reset button is not pressed upon startup. --- right/src/init_clock.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/right/src/init_clock.c b/right/src/init_clock.c index e8db090..b318fb8 100644 --- a/right/src/init_clock.c +++ b/right/src/init_clock.c @@ -1,6 +1,7 @@ #include "fsl_smc.h" #include "init_clock.h" #include "fsl_rtc.h" +#include "peripherals/reset_button.h" // How to setup clock using clock driver functions: // @@ -115,9 +116,11 @@ void InitClock(void) { // Set HSRUN power mode. SMC_SetPowerModeProtection(SMC, kSMC_AllowPowerModeAll); - SMC_SetPowerModeHsrun(SMC); - while (SMC_GetPowerModeState(SMC) != kSMC_PowerStateHsrun) - { + if (!RESET_BUTTON_IS_PRESSED) { + SMC_SetPowerModeHsrun(SMC); + while (SMC_GetPowerModeState(SMC) != kSMC_PowerStateHsrun) + { + } } // Set the system clock dividers in SIM to safe value. CLOCK_SetSimSafeDivs();