Working WatchdogTimer
This commit is contained in:
@@ -8,22 +8,25 @@ public class Watchdog
|
||||
return watchdogTimer;
|
||||
}
|
||||
|
||||
public static void increaseWatchdogTimer()
|
||||
public static void decreaseWatchdogTimer()
|
||||
{
|
||||
watchdogTimer++;
|
||||
watchdogTimer--;
|
||||
checkWatchdog();
|
||||
}
|
||||
|
||||
private static void checkWatchdog()
|
||||
{
|
||||
if(watchdogTimer > 18000)
|
||||
if(watchdogTimer == 0)
|
||||
{
|
||||
|
||||
System.out.println("Watchdog Time-Out");
|
||||
Memory.setRegister(0x03, Memory.getRegister(0x03) & 0xEF); //Clear !TO in StatusReg
|
||||
}
|
||||
}
|
||||
|
||||
private static void resetProgram()
|
||||
public static void resetProgram()
|
||||
{
|
||||
|
||||
Memory.setRegister(0x03, Memory.getRegister(0x03) | 0x10);
|
||||
watchdogTimer = 18000;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user