My stuff

Fork of Watchdog by Bernard Remond

Files at this revision

API Documentation at this revision

Comitter:
Mikk36
Date:
Mon Feb 01 10:12:00 2016 +0000
Parent:
6:40f189c7795b
Commit message:
Customizations

Changed in this revision

Watchdog.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 40f189c7795b -r 35390e6c25e8 Watchdog.cpp
--- a/Watchdog.cpp	Mon Mar 02 21:36:00 2015 +0000
+++ b/Watchdog.cpp	Mon Feb 01 10:12:00 2016 +0000
@@ -21,8 +21,8 @@
 /// @author Bernaérd Remond
 ///
 
-#define LPC
-//#define ST_NUCLEO
+//#define LPC
+#define ST_NUCLEO
 
 
 #include "mbed.h"
@@ -45,7 +45,8 @@
         wdreset = false; 
     }
 */        
-        wdreset = false; 
+        //wdreset = false; 
+    wdreset = (RCC->CSR & (1<<29)) ? true : false;
 #endif
 
 }
@@ -60,7 +61,7 @@
 #endif   
 #ifdef ST_NUCLEO
     // see http://embedded-lab.com/blog/?p=9662    
-    #define LsiFreq (45000)
+    #define LsiFreq (40000)
     
     uint16_t PrescalerCode;
     uint16_t Prescaler;
@@ -126,6 +127,11 @@
 
 /// get the flag to indicate if the watchdog causes the reset
 bool Watchdog::WatchdogCausedReset() {
+    //return wdreset;
+    
+    if (wdreset) {
+        RCC->CSR |= (1<<24); // clear reset flag
+    }
     return wdreset;
 }