File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed 
examples/Peripherals/Registers/Reset_reason Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change 1- #include  < STM32LowPower.h> 
2- #include  < low_power.h> 
3- 
41/*  Last Reset Reason Sketch
52* This sketch will determine what caused the last reset on the STM32 MCU. Most microcontrollers 
63* have a register dedicated to storing the last reason of the chip, weather being from a  
129
1310#include  " stm32yyxx_ll_rcc.h" 
1411#include  " IWatchdog.h" 
12+ //  #include "STM32LowPower.h"
1513
1614#define  USER_BTN_PIN  USER_BTN  //  Adjust this for your board
1715
@@ -36,6 +34,9 @@ static int default_button_state = LOW;
3634void  Reset_My_MCU () {
3735  //  There are a few reset conditions. Keep the one you wish to use and comment out the others.
3836
37+   //  Below is the WakeUp reset condition (needs STM32LowPower.h library)
38+   //  LowPower.shutdown(1000);
39+ 
3940  //  Below is the Software reset condition
4041  //  NVIC_SystemReset();
4142
@@ -82,7 +83,7 @@ void setup() {
8283#endif 
8384
8485
85-   //  Clear reset flags
86+   //  Clear internal  reset flags after they were captured 
8687  LL_RCC_ClearResetFlags ();
8788#if  defined(PWR_SCR_CSBF) || defined(PWR_CR1_CSBF) || defined(PWR_PMCR_CSSF) || defined(PWR_SR_CSSF)
8889#if  defined(STM32U0xx)
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments