@@ -35,86 +35,87 @@ inline void CPU_Sleep(SLEEP_LEVEL_type level, uint64_t wakeEvents)
3535void CPU_SetPowerMode (PowerLevel_type powerLevel )
3636{
3737 // default to false
38- //bool success = false;
38+ // bool success = false;
3939
4040 switch (powerLevel )
4141 {
4242 case PowerLevel__Off :
4343 // stop watchdog
44- //wdgStop(&WDGD1);
44+ // wdgStop(&WDGD1);
4545
4646 // gracefully shutdown everything
4747 nanoHAL_Uninitialize_C ();
4848
4949 __disable_irq ();
5050
51- // /////////////////////////////////////////////////////////////////////////
52- // // stop the idependent watchdog, for series where the option is available
53- // #if defined(STM32L4XX)
51+ // /////////////////////////////////////////////////////////////////////////
52+ // // stop the idependent watchdog, for series where the option is available
53+ // #if defined(STM32L4XX)
5454
55- // (void)success;
56- // // TODO FIXME this code needs to follow the same workflow as the STM32F7
57- // CLEAR_BIT(FLASH->OPTR, FLASH_OPTR_IWDG_STDBY);
58- // #elif defined(STM32F7XX)
55+ // (void)success;
56+ // // TODO FIXME this code needs to follow the same workflow as the STM32F7
57+ // CLEAR_BIT(FLASH->OPTR, FLASH_OPTR_IWDG_STDBY);
58+ // #elif defined(STM32F7XX)
5959
60- // // only need to change this option bit if not already done
61- // if ((FLASH->OPTCR & FLASH_OPTCR_IWDG_STDBY))
62- // {
63- // // developer notes:
64- // // follow workflow recommended @ 3.4.2 Option bytes programming (from programming manual)
65- // // Authorizes the Option Byte register programming
66- // FLASH->OPTKEYR = FLASH_OPT_KEY1;
67- // FLASH->OPTKEYR = FLASH_OPT_KEY2;
60+ // // only need to change this option bit if not already done
61+ // if ((FLASH->OPTCR & FLASH_OPTCR_IWDG_STDBY))
62+ // {
63+ // // developer notes:
64+ // // follow workflow recommended @ 3.4.2 Option bytes programming (from programming manual)
65+ // // Authorizes the Option Byte register programming
66+ // FLASH->OPTKEYR = FLASH_OPT_KEY1;
67+ // FLASH->OPTKEYR = FLASH_OPT_KEY2;
6868
69- // // wait 500ms for any flash operation to be completed
70- // success = FLASH_WaitForLastOperation(500);
69+ // // wait 500ms for any flash operation to be completed
70+ // success = FLASH_WaitForLastOperation(500);
7171
72- // if (success)
73- // {
74- // // write option value (clear the FLASH_OPTCR_IWDG_STDBY)
75- // CLEAR_BIT(FLASH->OPTCR, FLASH_OPTCR_IWDG_STDBY);
72+ // if (success)
73+ // {
74+ // // write option value (clear the FLASH_OPTCR_IWDG_STDBY)
75+ // CLEAR_BIT(FLASH->OPTCR, FLASH_OPTCR_IWDG_STDBY);
7676
77- // // set the option start bit
78- // FLASH->OPTCR |= FLASH_OPTCR_OPTSTRT;
77+ // // set the option start bit
78+ // FLASH->OPTCR |= FLASH_OPTCR_OPTSTRT;
7979
80- // // Data synchronous Barrier, forcing the CPU to respect the sequence of instruction without
81- // // optimization
82- // __DSB();
80+ // // Data synchronous Barrier, forcing the CPU to respect the sequence of instruction
81+ // without
82+ // // optimization
83+ // __DSB();
8384
84- // // wait 100ms for the flash operation to be completed
85- // success = FLASH_WaitForLastOperation(100);
86- // }
85+ // // wait 100ms for the flash operation to be completed
86+ // success = FLASH_WaitForLastOperation(100);
87+ // }
8788
88- // // Set the OPTLOCK Bit to lock the FLASH Option Byte Registers access
89- // FLASH->OPTCR |= FLASH_OPTCR_OPTLOCK;
90- // }
89+ // // Set the OPTLOCK Bit to lock the FLASH Option Byte Registers access
90+ // FLASH->OPTCR |= FLASH_OPTCR_OPTLOCK;
91+ // }
9192
92- // (void)success;
93+ // (void)success;
9394
94- // #endif
95+ // #endif
9596
96- // /////////////////////////////////////////////////////
97- // // set alarm interrupt enable
98- // // set power control register to: power down deep sleep
99- // /////////////////////////////////////////////////////
97+ // /////////////////////////////////////////////////////
98+ // // set alarm interrupt enable
99+ // // set power control register to: power down deep sleep
100+ // /////////////////////////////////////////////////////
100101
101- // // TODO
102- // //__HAL_RTC_ALARMA_ENABLE(&RtcHandle);
103- // //__HAL_RTC_ALARM_ENABLE_IT(&RtcHandle, RTC_IT_ALRA);
102+ // // TODO
103+ // //__HAL_RTC_ALARMA_ENABLE(&RtcHandle);
104+ // //__HAL_RTC_ALARM_ENABLE_IT(&RtcHandle, RTC_IT_ALRA);
104105
105- // // TODO
106- // // need review here to use ST HAL HAL_PWREx_EnterSTOP2Mode
106+ // // TODO
107+ // // need review here to use ST HAL HAL_PWREx_EnterSTOP2Mode
107108
108- // #if defined(STM32F7XX)
109+ // #if defined(STM32F7XX)
109110
110- // //////////////////////////////////////////////////////////////////////////////////////////////////////
111- // // workaround recommended in section 2.2.2 at STM32F77xxx errata document (DM00257543 - ES0334 Rev 5) //
112- // PWR->CSR1 |= PWR_CSR1_EIWUP;
113- // //////////////////////////////////////////////////////////////////////////////////////////////////////
111+ // //////////////////////////////////////////////////////////////////////////////////////////////////////
112+ // // workaround recommended in section 2.2.2 at STM32F77xxx errata document (DM00257543 -
113+ // ES0334 Rev 5) // PWR->CSR1 |= PWR_CSR1_EIWUP;
114+ // //////////////////////////////////////////////////////////////////////////////////////////////////////
114115
115- // SET_BIT(PWR->CR1, PWR_CR1_PDDS);
116+ // SET_BIT(PWR->CR1, PWR_CR1_PDDS);
116117
117- // #endif
118+ // #endif
118119
119120 // set SLEEPDEEP bit of Cortex SCR
120121 SCB -> SCR &= SCB_SCR_SLEEPDEEP_Msk ;
0 commit comments