void hardware_init(void) { /* enable clock for PORTs */ CLOCK_SYS_EnablePortClock(PORTA_IDX); CLOCK_SYS_EnablePortClock(PORTC_IDX); CLOCK_SYS_EnablePortClock(PORTE_IDX); #if FSL_FEATURE_SIM_OPT_HAS_RTC_CLOCK_OUT_SELECTION configure_rtc_pins(0); #endif if(PMC_HAL_GetAckIsolation(PMC_BASE_PTR) != 0) { PMC_HAL_ClearAckIsolation(PMC_BASE_PTR); } /* Init board clock */ BOARD_ClockInit(); setup_uart_pins(kPortMuxAlt2); #if (CLOCK_INIT_CONFIG == CLOCK_VLPR) CLOCK_SYS_SetLpuartSrc(BOARD_DEBUG_UART_INSTANCE, kClockLpuartSrcMcgIrClk); #else CLOCK_SYS_SetLpuartSrc(BOARD_DEBUG_UART_INSTANCE, kClockLpuartSrcIrc48M); #endif DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_LOW_POWER_UART_BAUD, kDebugConsoleLPUART); }
void hardware_init(void) { /* enable clock for PORTs */ CLOCK_SYS_EnablePortClock(PORTA_IDX); CLOCK_SYS_EnablePortClock(PORTB_IDX); CLOCK_SYS_EnablePortClock(PORTC_IDX); CLOCK_SYS_EnablePortClock(PORTD_IDX); CLOCK_SYS_EnablePortClock(PORTE_IDX); #if FSL_FEATURE_SIM_OPT_HAS_RTC_CLOCK_OUT_SELECTION configure_rtc_pins(0); #endif if(PMC_HAL_GetAckIsolation(PMC_BASE_PTR) != 0) { PMC_HAL_ClearAckIsolation(PMC_BASE_PTR); } /* Init board clock */ BOARD_ClockInit(); setup_uart_pins(kPortMuxAlt3); DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_LOW_POWER_UART_BAUD, kDebugConsoleUART); }
/******************************************************************************* * Callback function for Clock Manager. ******************************************************************************/ clock_manager_error_code_t clockManagerCallback(clock_notify_struct_t *notify, void* callbackData) { clock_manager_error_code_t ret = kClockManagerError; switch (notify->notifyType) { case kClockManagerNotifyBefore: DbgConsole_DeInit(); ret = kClockManagerSuccess; break; case kClockManagerNotifyRecover: case kClockManagerNotifyAfter: DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_LOW_POWER_UART_BAUD, kDebugConsoleUART); ret = kClockManagerSuccess; break; default: break; } return ret; }
/*FUNCTION********************************************************************* * * Function Name : dbg_console_cm_callback * Description : debug console callback for change event from power manager * *END*************************************************************************/ clock_manager_error_code_t dbg_console_cm_callback(clock_notify_struct_t *notify, void* callbackData) { clock_manager_error_code_t result = kClockManagerSuccess; switch (notify->notifyType) { case kClockManagerNotifyBefore: // Received "pre" message DbgConsole_DeInit(); break; case kClockManagerNotifyRecover: // Received "recover" message case kClockManagerNotifyAfter: // Received "post" message if (CLOCK_VLPR == CLOCK_SYS_GetCurrentConfiguration()) { CLOCK_SYS_SetLpuartSrc(BOARD_DEBUG_UART_INSTANCE, kClockLpuartSrcMcgIrClk); } else { CLOCK_SYS_SetLpuartSrc(BOARD_DEBUG_UART_INSTANCE, kClockLpuartSrcMcgFllClk); } DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_LOW_POWER_UART_BAUD, kDebugConsoleLPUART); break; default: result = kClockManagerError; break; } return result; }
void hardware_init(void) { /* enable clock for PORTs */ CLOCK_SYS_EnablePortClock(PORTA_IDX); CLOCK_SYS_EnablePortClock(PORTB_IDX); #if FSL_FEATURE_SIM_OPT_HAS_RTC_CLOCK_OUT_SELECTION configure_rtc_pins(0); #endif if(PMC_HAL_GetAckIsolation(PMC_BASE_PTR) != 0) { PMC_HAL_ClearAckIsolation(PMC_BASE_PTR); } /* Disable debug pins in release target */ #if defined (NDEBUG) setup_debug_pins(kPortPinDisabled); #endif /* Init board clock */ BOARD_ClockInit(); setup_uart_pins(kPortMuxAlt2); // Select different clock source for LPSCI. */ #if (CLOCK_INIT_CONFIG == CLOCK_VLPR) CLOCK_SYS_SetLpsciSrc(BOARD_DEBUG_UART_INSTANCE, kClockLpsciSrcMcgIrClk); #else CLOCK_SYS_SetLpsciSrc(BOARD_DEBUG_UART_INSTANCE, kClockLpsciSrcFll); #endif DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_LOW_POWER_UART_BAUD, kDebugConsoleLPSCI); }
/* Re-init uart module. */ void dbg_uart_reinit() { if (CLOCK_VLPR == CLOCK_SYS_GetCurrentConfiguration()) { CLOCK_SYS_SetLpuartSrc(BOARD_DEBUG_UART_INSTANCE, kClockLpuartSrcMcgIrClk); } else { CLOCK_SYS_SetLpuartSrc(BOARD_DEBUG_UART_INSTANCE, kClockLpuartSrcIrc48M); } DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_LOW_POWER_UART_BAUD, kDebugConsoleLPUART); }
void dbg_uart_init(void) { configure_uart_pins(BOARD_DEBUG_UART_INSTANCE); #if (CLOCK_SETUP == 1) CLOCK_SYS_SetLpuartSrc(0, kClockLpuartSrcIrc48M); #else CLOCK_SYS_SetLpuartSrc(0, kClockLpuartSrcMcgIrClk); #endif DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUD, kDebugConsoleLPUART); }
void Components_Init(void) { /*! DbgCs1 Auto initialization start */ /* Debug console initialization */ DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, DEBUG_UART_BAUD, DEBUG_UART_TYPE); /*! DbgCs1 Auto initialization end */ /*! gpio1 Auto initialization start */ GPIO_DRV_Init(NULL,gpio1_OutConfig0); /*! gpio1 Auto initialization end */ }
/* Initialize debug console. */ status_t BOARD_InitDebugConsole(void) { status_t result; /* attach 12 MHz clock to FLEXCOMM0 (debug console) */ CLOCK_AttachClk(kFRO12M_to_FLEXCOMM0); RESET_PeripheralReset(BOARD_DEBUG_UART_RST); result = DbgConsole_Init(BOARD_DEBUG_UART_BASEADDR, BOARD_DEBUG_UART_BAUDRATE, DEBUG_CONSOLE_DEVICE_TYPE_FLEXCOMM, BOARD_DEBUG_UART_CLK_FREQ); assert(kStatus_Success == result); return result; }
void BoardInitMcu( void ) { if ( McuInitialized == false ) { /* Initialize low level components */ low_level_init(); /*! SPI channel to be used by Semtech SX1276 */ #if defined(SX1276_BOARD_EMBED) SpiInit(&SX1276.Spi, RADIO_MOSI, RADIO_MISO, RADIO_SCLK, NC); SX1276IoInit(); #endif #if defined (USE_USB_CDC) UartInit( &UartUsb, UART_USB_CDC, NC, NC ); UartConfig( &UartUsb, RX_TX, 115200, UART_8_BIT, UART_1_STOP_BIT, NO_PARITY, NO_FLOW_CTRL ); TimerSetLowPowerEnable(false); #elif defined(DEBUG) #if defined(USE_SHELL) Shell_Init(); #else #if !defined(USE_CUSTOM_UART_HAL) FifoInit(&Uart1.FifoRx, DbgRxBuffer, DBG_FIFO_RX_SIZE); FifoInit(&Uart1.FifoTx, DbgTxBuffer, DBG_FIFO_TX_SIZE); #endif UartInit(&Uart1, UART_1, UART1_TX, UART1_RX); UartConfig(&Uart1, RX_TX, 115200, UART_8_BIT, UART_1_STOP_BIT, NO_PARITY, NO_FLOW_CTRL); #endif DbgConsole_Init(&Uart1); TimerSetLowPowerEnable(false); #elif( LOW_POWER_MODE_ENABLE ) TimerSetLowPowerEnable(true); #else TimerSetLowPowerEnable(false); #endif BoardUnusedIoInit(); #if !defined(USE_FREE_RTOS) if ( TimerGetLowPowerEnable() == true ) { RtcInit(); } else { TimerHwInit(); } #endif /* USE_FREE_RTOS */ McuInitialized = true; } }
/* Initialize debug console. */ void BOARD_InitDebugConsole(void) { uint32_t uartClkSrcFreq; /* SIM_SOPT2[27:26]: * 00: Clock Disabled * 01: IRC48M * 10: OSCERCLK * 11: MCGIRCCLK */ CLOCK_SetLpuart0Clock(1); uartClkSrcFreq = BOARD_DEBUG_UART_CLK_FREQ; // DbgConsole_Init(BOARD_DEBUG_UART_BASEADDR, BOARD_DEBUG_UART_BAUDRATE, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq); DbgConsole_Init(BOARD_DEBUG_UART_BASEADDR, 38400, BOARD_DEBUG_UART_TYPE, uartClkSrcFreq); }
/*FUNCTION********************************************************************* * * Function Name : dbg_console_cm_callback * Description : debug console callback for change event from power manager * *END*************************************************************************/ clock_manager_error_code_t dbg_console_cm_callback(clock_notify_struct_t *notify, void* callbackData) { clock_manager_error_code_t result = kClockManagerSuccess; switch (notify->notifyType) { case kClockManagerNotifyBefore: // Received "pre" message DbgConsole_DeInit(); break; case kClockManagerNotifyRecover: // Received "recover" message case kClockManagerNotifyAfter: // Received "post" message DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_LOW_POWER_UART_BAUD, kDebugConsoleUART); break; default: result = kClockManagerError; break; } return result; }
static void hw_uart_init(void) { register uint16_t sbr, brfa; uint8_t temp; #ifdef FREESCALE_KSDK_BM PORT_SetPinMux(UART_TX_PORT, UART_TX_PIN, UART_TX_MUX); CLOCK_SetLpuartClock(1); /* MCGPLLCLK */ DbgConsole_Init((uint32_t)UART_PORT, UART_BAUD, DEBUG_CONSOLE_DEVICE_TYPE_LPUART, SYS_CLK_HZ); #else /* Enable UART core clock */ /* Note: Remember to update me if UART_PORT changes */ SIM->SCGC1 |= SIM_SCGC1_UART4_MASK; /* Configure UART TX pin */ UART_TX_PORT->PCR[UART_TX_PIN] = PORT_PCR_MUX(UART_TX_MUX); /* Disable transmitter and receiver while we change settings. */ UART_PORT->C2 &= ~(UART_C2_TE_MASK | UART_C2_RE_MASK ); /* Configure the UART for 8-bit mode, no parity */ UART_PORT->C1 = 0; /* Calculate baud settings */ sbr = (uint16_t)((BUS_CLK_KHZ * 1000)/(UART_BAUD * 16)); temp = UART_PORT->BDH & ~(UART_BDH_SBR(0x1F)); UART_PORT->BDH = temp | UART_BDH_SBR(((sbr & 0x1F00) >> 8)); UART_PORT->BDL = (uint8_t)(sbr & UART_BDL_SBR_MASK); /* Determine if a fractional divider is needed to get closer to the baud rate */ brfa = (((BUS_CLK_KHZ * 32000)/(UART_BAUD * 16)) - (sbr * 32)); temp = UART_PORT->C4 & ~(UART_C4_BRFA(0x1F)); UART_PORT->C4 = temp | UART_C4_BRFA(brfa); /* Enable receiver and transmitter */ UART_PORT->C2 |= (UART_C2_TE_MASK | UART_C2_RE_MASK); #endif }
/* Re-init uart module. */ void dbg_uart_reinit() { DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_LOW_POWER_UART_BAUD, kDebugConsoleUART); }
void dbg_uart_init(void) { configure_uart_pins(BOARD_DEBUG_UART_INSTANCE); DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_DEBUG_UART_BAUD, kDebugConsoleUART); }
/******************************************************************************* * Main function for application. ******************************************************************************/ void lab2_power(void) { demo_power_modes_t testVal = kDemoRun; volatile uint8_t powerMode; uint8_t clockManagerMode = CLOCK_RUN; uint32_t freq = 0; //******************************************************* //* Step 1: Initialize the Clock Manager configurations. //******************************************************* // Create list of supported clock configurations. These are taken from the // board.c file and will be passed into CLOCK_SYS_Init(). clock_manager_user_config_t const *clockConfigs[] = { NULL, &g_defaultClockConfigVlpr, &g_defaultClockConfigRun, &g_defaultClockConfigHsrun, }; //***************************************************** //* Step 2: Configure Clock Manager callback function. //***************************************************** // Clock Manager callback function. clock_manager_callback_user_config_t clockManagerCallbackCfg = { .callback = clockManagerCallback, .callbackType = kClockManagerCallbackBeforeAfter, .callbackData = NULL }; clock_manager_callback_user_config_t *clockCallbacks[] = { &clockManagerCallbackCfg }; //***************************************************** //* Step 3: Initialize the Clock Manager. //***************************************************** // Pass in configuration and callback data to Clock Manager. CLOCK_SYS_Init(clockConfigs, CLOCK_NUMBER_OF_CONFIGURATIONS, clockCallbacks, ARRAY_SIZE(clockCallbacks)); // Set to RUN mode. CLOCK_SYS_UpdateConfiguration(CLOCK_RUN, kClockManagerPolicyForcible); //***************************************************** //* Step 4: Set up supported power mode structures. //***************************************************** const power_manager_user_config_t runConfig = { .mode = kPowerManagerRun, .sleepOnExitValue = false, }; power_manager_user_config_t hsrunConfig = runConfig; hsrunConfig.mode = kPowerManagerHsrun; power_manager_user_config_t waitConfig = runConfig; waitConfig.mode = kPowerManagerWait; power_manager_user_config_t stopConfig = runConfig; stopConfig.mode = kPowerManagerStop; power_manager_user_config_t vlprConfig = runConfig; vlprConfig.mode = kPowerManagerVlpr; power_manager_user_config_t vlpwConfig = runConfig; vlpwConfig.mode = kPowerManagerVlpw; power_manager_user_config_t vlpsConfig = runConfig; vlpsConfig.mode = kPowerManagerVlps; power_manager_user_config_t lls3Config = runConfig; lls3Config.mode = kPowerManagerLls3; power_manager_user_config_t vlls0Config = runConfig; vlls0Config.mode = kPowerManagerVlls0; //*********************************************************** //* Step 5: Configure managed power configurations structure. //*********************************************************** // Create the list of supported modes to pass into the Power Manager. power_manager_user_config_t const *powerConfigs[] = { &runConfig, &hsrunConfig, &waitConfig, &stopConfig, &vlprConfig, &vlpwConfig, &vlpsConfig, &lls3Config, &vlls0Config }; //***************************************************** //* Step 6: Configure Power Manager callback function. //***************************************************** // Initializes callback configuration structure for the Power Manager. power_manager_callback_user_config_t powerManagerCallbackCfg = { .callback = powerManagerCallback, .callbackType = kPowerManagerCallbackBeforeAfter, .callbackData = NULL }; // Initializes array of pointers to power manager callbacks. power_manager_callback_user_config_t *powerCallbacks[] = { &powerManagerCallbackCfg }; //***************************************************** //* Step 7: Initialize the Power Manager. //***************************************************** // Pass power configurations and callback info to Power Manager. POWER_SYS_Init(powerConfigs, sizeof(powerConfigs) / sizeof(power_manager_user_config_t *), powerCallbacks, ARRAY_SIZE(powerCallbacks)); // Initialize system to RUN mode. powerMode = kDemoRun - kDemoMin - 1; POWER_SYS_SetMode(powerMode, kPowerManagerPolicyAgreement); //************************************************************** //* Step 8: Configure the rest of the chip for this application. //************************************************************** // Configure pin mux for UART functionality. configure_uart_pins(BOARD_DEBUG_UART_INSTANCE); // Initializes GPIO driver for LEDs and buttons GPIO_DRV_Init(switchPins, ledPins); // Initialize the debug UART console. DbgConsole_Init(BOARD_DEBUG_UART_INSTANCE, BOARD_LOW_POWER_UART_BAUD, kDebugConsoleUART); // Enable PORTC clock for GPIO/LLWU interrupt. CLOCK_SYS_EnablePortClock(2); // Enables falling edge interrupt for switch SW2. PORT_HAL_SetMuxMode(BOARD_SW_LLWU_BASE, BOARD_SW_LLWU_PIN, kPortMuxAsGpio); PORT_HAL_SetPinIntMode(BOARD_SW_LLWU_BASE, BOARD_SW_LLWU_PIN, kPortIntFallingEdge); // Enable GPIO interrupt. INT_SYS_EnableIRQ(PORTC_IRQn); // Configure the LLWU. LLWU_HAL_ClearExternalPinWakeupFlag(LLWU, BOARD_SW_LLWU_EXT_PIN); LLWU_HAL_SetExternalInputPinMode(LLWU, kLlwuExternalPinFallingEdge, BOARD_SW_LLWU_EXT_PIN); // Enable LLWU interrupt. INT_SYS_EnableIRQ(LLWU_IRQn); // Main loop. while (1) { // Get the system clock frequency and current clock configuration to print out. CLOCK_SYS_GetFreq(kCoreClock, &freq); clockManagerMode = CLOCK_SYS_GetCurrentConfiguration(); PRINTF("\n\r#################### Power Manager Demo ####################\n\n\r"); PRINTF(" Core Clock = %d MHz \n\r", freq / 1000000); PRINTF(" Current Mode = "); switch(clockManagerMode) { case CLOCK_RUN: PRINTF("RUN\n\r"); break; case CLOCK_VLPR: PRINTF("VLPR\n\r"); break; case CLOCK_HSRUN: PRINTF("HSRUN\n\r"); break; } PRINTF("\n\rSelect the desired operation \n\n\r"); PRINTF("Press %c for enter: RUN - Normal RUN mode\n\r", kDemoRun); PRINTF("Press %c for enter: HSRUN - High Speed RUN mode\n\r", kDemoHsRun); PRINTF("Press %c for enter: Wait - Wait mode\n\r", kDemoWait); PRINTF("Press %c for enter: Stop - Stop mode\n\r", kDemoStop); PRINTF("Press %c for enter: VLPR - Very Low Power Run mode\n\r", kDemoVlpr); PRINTF("Press %c for enter: VLPW - Very Low Power Wait mode\n\r", kDemoVlpw); PRINTF("Press %c for enter: VLPS - Very Low Power Stop mode\n\r", kDemoVlps); PRINTF("Press %c for enter: LLS3 - Low Leakage Stop mode\n\r", kDemoLls3); PRINTF("Press %c for enter: VLLS0 - Very Low Leakage Stop mode 0\n\r", kDemoVlls0); //PRINTF("Press %c for enter: VLLS3 - Very Low Leakage Stop mode 3\n\r", kDemoVlls3); PRINTF("\n\rWaiting for key press...\n\r\n\r"); // Wait for user input. testVal = (demo_power_modes_t)GETCHAR(); if ((testVal >= 'a') && (testVal <= 'z')) { testVal -= 'a' - 'A'; } if (testVal > kDemoMin && testVal < kDemoMax) { // Obtain Power Manager readable version of the value passed in. powerMode = testVal - kDemoMin - 1; // Switch to selected mode. switch (testVal) { case kDemoRun: if (POWER_SYS_GetCurrentMode() == kPowerManagerRun) { PRINTF("Run mode already active.\n\r"); break; } // Update the power configuration. POWER_SYS_SetMode(powerMode, kPowerManagerPolicyAgreement); // Update the clock configuration. CLOCK_SYS_UpdateConfiguration(CLOCK_RUN, kClockManagerPolicyAgreement); break; case kDemoHsRun: if (POWER_SYS_GetCurrentMode() == kPowerManagerHsrun) { PRINTF("High Speed Run mode already active.\n\r"); break; } // Update the power configuration. POWER_SYS_SetMode(powerMode, kPowerManagerPolicyAgreement); // Update the clock configuration. CLOCK_SYS_UpdateConfiguration(CLOCK_HSRUN, kClockManagerPolicyAgreement); break; case kDemoWait: if (POWER_SYS_GetCurrentMode() == kPowerManagerVlpr) { PRINTF("Cannot go from VLPR to WAIT directly...\n\r"); break; } if (POWER_SYS_GetCurrentMode() == kPowerManagerHsrun) { PRINTF("Cannot go from HSRUN to WAIT directly...\n\r"); break; } PRINTF("Entering WAIT mode. Press SW2 to wake...\n\r"); // Update the power configuration. POWER_SYS_SetMode(powerMode, kPowerManagerPolicyAgreement); break; case kDemoStop: if (POWER_SYS_GetCurrentMode() == kPowerManagerVlpr) { PRINTF("Cannot go from VLPR to STOP directly...\n\r"); break; } if (POWER_SYS_GetCurrentMode() == kPowerManagerHsrun) { PRINTF("Cannot go from HSRUN to STOP directly...\n\r"); break; } PRINTF("Entering STOP mode. Press SW2 to wake...\n\r"); // Update the power configuration. POWER_SYS_SetMode(powerMode, kPowerManagerPolicyAgreement); // Update the clock configuration. CLOCK_SYS_UpdateConfiguration(clockManagerMode, kClockManagerPolicyAgreement); break; case kDemoVlpr: if (POWER_SYS_GetCurrentMode() == kPowerManagerHsrun) { PRINTF("Cannot go from HSRUN to VLPR directly...\n\r"); break; } if(POWER_SYS_GetCurrentMode() != kPowerManagerVlpr) { // Update the clock configuration PRIOR to entering VLPR. CLOCK_SYS_UpdateConfiguration(CLOCK_VLPR, kClockManagerPolicyAgreement); // Update the power configuration. POWER_SYS_SetMode(powerMode, kPowerManagerPolicyAgreement); } else { PRINTF("Very Low Power Run mode already active.\n\r"); } break; case kDemoVlpw: if (POWER_SYS_GetCurrentMode() == kPowerManagerRun) { PRINTF("Cannot go from RUN to VLPW directly...\n\r"); break; } if (POWER_SYS_GetCurrentMode() == kPowerManagerHsrun) { PRINTF("Cannot go from HSRUN to VLPW directly...\n\r"); break; } PRINTF("Entering VLPW mode. Press SW2 to wake...\n\r"); // Update the power configuration. POWER_SYS_SetMode(powerMode, kPowerManagerPolicyAgreement); break; case kDemoVlps: if (POWER_SYS_GetCurrentMode() == kPowerManagerHsrun) { PRINTF("Cannot go from HSRUN to VLPS directly...\n\r"); break; } PRINTF("Entering VLPS mode. Press SW2 to wake...\n\r"); // Update the power configuration. POWER_SYS_SetMode(powerMode, kPowerManagerPolicyAgreement); // If we entered via RUN mode, restore clock settings. if (POWER_SYS_GetCurrentMode() == kPowerManagerRun) { CLOCK_SYS_UpdateConfiguration(clockManagerMode, kClockManagerPolicyAgreement); } break; case kDemoLls3: if (POWER_SYS_GetCurrentMode() == kPowerManagerHsrun) { PRINTF("Cannot go from HSRUN to LLSx directly...\n\r"); break; } PRINTF("Entering LLS3 mode. Press SW2 to wake...\n\r"); // Update the power configuration. POWER_SYS_SetMode(powerMode, kPowerManagerPolicyAgreement); // Check the mode active mode prior to LLS3 entry. if(POWER_SYS_GetCurrentMode() != kPowerManagerVlpr) { CLOCK_SYS_UpdateConfiguration(clockManagerMode, kClockManagerPolicyAgreement); } break; case kDemoVlls0: if (POWER_SYS_GetCurrentMode() == kPowerManagerHsrun) { PRINTF("Cannot go from HSRUN to VLLSx directly...\n\r"); break; } PRINTF("Press SW2 to wake. VLLSx wake goes through RESET sequence.\n\r"); // Update the power configuration. POWER_SYS_SetMode(powerMode, kPowerManagerPolicyAgreement); break; default: PRINTF("Bad value."); break; } PRINTF("\n\rNext loop\n\r"); } } }