Interrupts/Call
This commit is contained in:
@ -13,18 +13,22 @@ public class Interrupts {
|
||||
private static final int INTE = 0x4;
|
||||
private static final int INTF = 0x1;
|
||||
|
||||
public static void triggerTMR0() {
|
||||
public static void triggerTMR0(boolean manual) {
|
||||
triggerInterrupt(T0IF, T0IE);
|
||||
if (manual)
|
||||
DataRegister.increasePC();
|
||||
}
|
||||
|
||||
private static void triggerInterrupt(int flag, int enableFlag) {
|
||||
DataRegister.setBit(INTCON, flag);
|
||||
enableFlag = DataRegister.getDirectBit(INTCON, enableFlag);
|
||||
int globalFlag = DataRegister.getDirectBit(INTCON, GIE);
|
||||
if (globalFlag == 1 && enableFlag == 1) {
|
||||
DataRegister.clearBit(INTCON, GIE);
|
||||
Commands.CALL(ISR, false);
|
||||
Controller_Frontend.stopRunFromBackend("Interrupt", false);
|
||||
if (enableFlag == 1) {
|
||||
Controller_Frontend.wakeUpFromSleep();
|
||||
if (globalFlag == 1) {
|
||||
DataRegister.clearBit(INTCON, GIE);
|
||||
Commands.CALL(ISR);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -32,6 +36,7 @@ public class Interrupts {
|
||||
public static void triggerRBInterrupt(int oldValue, int newValue) {
|
||||
if (newValue != oldValue){
|
||||
triggerInterrupt(RBIF, RBIE);
|
||||
DataRegister.increasePC();
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,6 +50,7 @@ public class Interrupts {
|
||||
if (oldValue == 1 && newValue == 0)
|
||||
triggerInterrupt(INTF, INTE);
|
||||
}
|
||||
DataRegister.increasePC();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user