Arduino: separated interrupt callbacks

Java: fixed TC
This commit is contained in:
Ziver Koc 2016-05-26 16:35:22 +02:00
parent 17e50573d6
commit 15555ea7eb
5 changed files with 34 additions and 30 deletions

View file

@ -7,22 +7,31 @@ typedef void (*InterruptFunction) ();
class Interrupt
{
public:
static void wakeUp();
static void wakeUp() { wakeUpNow = true; };
static void sleep();
static void setupPinInterrupt(int pin);
static void setupWatchDogInterrupt(unsigned int milliseconds);
//static void setupTimerInterrupt(unsigned int milliseconds);
static void setCallback(InterruptFunction callback){ Interrupt::callback = callback;}
static InterruptFunction getCallback(){ return Interrupt::callback;}
static void setPinCallback(InterruptFunction callback){ Interrupt::pinCallback = callback;}
static void setWatchDogCallback(InterruptFunction callback){ Interrupt::wdtCallback = callback;}
/* Should not be called externally, used as triggering functions */
static void handlePinInterrupt();
static void handleWatchDogInterrupt();
private:
static InterruptFunction callback;
static bool wakeUpNow;
static InterruptFunction pinCallback;
static InterruptFunction wdtCallback;
static void setupWatchDogInterrupt();
// Disable constructors and copy operators
Interrupt() {};
Interrupt(Interrupt const&);
void operator=(Interrupt const&);
};