Basic implementation of watchdog

Dependencies:   STM_ResetSupervisor USBDevice

Committer:
t1jain
Date:
Tue Jun 25 23:49:40 2019 +0000
Revision:
1:38b385f34687
Parent:
0:975e02a70882
Child:
2:50b1371247da
Updated Watchdog basic with min. timeout

Who changed what in which revision?

UserRevisionLine numberNew contents of line
JesiMiranda 0:975e02a70882 1 #include "mbed.h"
JesiMiranda 0:975e02a70882 2 #include <ros.h>
JesiMiranda 0:975e02a70882 3 #include <nav_msgs/Odometry.h> //contains both the twist and pose
JesiMiranda 0:975e02a70882 4 #include "Watchdog.h"
JesiMiranda 0:975e02a70882 5
t1jain 1:38b385f34687 6 int i = 1;
JesiMiranda 0:975e02a70882 7
JesiMiranda 0:975e02a70882 8 Serial pc(USBTX, USBRX, 57600); //Serial Monitor
JesiMiranda 0:975e02a70882 9
JesiMiranda 0:975e02a70882 10 int main(void)
JesiMiranda 0:975e02a70882 11 {
JesiMiranda 0:975e02a70882 12 Watchdog dog;
JesiMiranda 0:975e02a70882 13 dog.Configure(1);
t1jain 1:38b385f34687 14 pc.printf("I'm resetting!\n", dog.WatchdogCausedReset());
JesiMiranda 0:975e02a70882 15
t1jain 1:38b385f34687 16 while(i++)
JesiMiranda 0:975e02a70882 17 {
t1jain 1:38b385f34687 18 pc.printf("Hello! I'm working! Iteration: %d \n", i);
t1jain 1:38b385f34687 19 wait(0.9);
t1jain 1:38b385f34687 20
t1jain 1:38b385f34687 21 if (i == 10) {
t1jain 1:38b385f34687 22 wait(0.6);
t1jain 1:38b385f34687 23 }
t1jain 1:38b385f34687 24
t1jain 1:38b385f34687 25
JesiMiranda 0:975e02a70882 26 dog.Service();
JesiMiranda 0:975e02a70882 27 //return 0;
JesiMiranda 0:975e02a70882 28 }
JesiMiranda 0:975e02a70882 29 }