Working Component Management
This commit is contained in:
@ -2,29 +2,14 @@ package fabrik.simulator.pic16f84;
|
||||
|
||||
import fabrik.simulator.pic16f84.interfaces.*;
|
||||
|
||||
public class WatchdogTimer implements WatchdogTimerInterface {
|
||||
public class WatchdogTimer extends PICComponent implements WatchdogTimerInterface {
|
||||
private long watchdogTime;
|
||||
private double lastReset = 0;
|
||||
private boolean enabled = false;
|
||||
private long rawtimer = 0;
|
||||
private long realtimer = 0;
|
||||
|
||||
|
||||
private final DataRegisterInterface dataRegister;
|
||||
private final ProgramStackInterface programStack;
|
||||
private final FrontendControllerInterface frontendController;
|
||||
private final PreScaler preScaler;
|
||||
private final CommandInterface command;
|
||||
|
||||
|
||||
public WatchdogTimer( DataRegisterInterface dataRegister, ProgramStackInterface programStack, FrontendControllerInterface frontendController,PreScaler preScaler, CommandInterface command){
|
||||
|
||||
this.dataRegister = dataRegister;
|
||||
this.programStack = programStack;
|
||||
this.preScaler = preScaler;
|
||||
this.command = command;
|
||||
this.frontendController = frontendController;
|
||||
|
||||
public WatchdogTimer(){
|
||||
}
|
||||
|
||||
private long getTimeFromRegister() {
|
||||
@ -36,7 +21,7 @@ public class WatchdogTimer implements WatchdogTimerInterface {
|
||||
if (enabled) {
|
||||
if (realtimer >= (watchdogTime + lastReset - 1)) {
|
||||
dataRegister.clearBit(3, 4);
|
||||
lastReset = command.getTotalExecutionTime();
|
||||
lastReset = commands.getTotalExecutionTime();
|
||||
frontendController.stopRunFromBackend("Watchdog Timer");
|
||||
}
|
||||
else {
|
||||
@ -47,7 +32,7 @@ public class WatchdogTimer implements WatchdogTimerInterface {
|
||||
}
|
||||
|
||||
public void reset (){
|
||||
lastReset = command.getTotalExecutionTime();
|
||||
lastReset = commands.getTotalExecutionTime();
|
||||
rawtimer = 0;
|
||||
realtimer = 0;
|
||||
preScaler.reset();
|
||||
@ -69,6 +54,6 @@ public class WatchdogTimer implements WatchdogTimerInterface {
|
||||
|
||||
@Override
|
||||
public void initialize(PICComponents picComponents) {
|
||||
|
||||
super.initialize(picComponents);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user