hal/arduino/HalMultiSensor/Interrupt.h

39 lines
1 KiB
C
Raw Normal View History

#ifndef INTERRUPT_H
#define INTERRUPT_H
2016-07-08 22:14:23 +02:00
#include <Arduino.h>
2016-02-24 21:51:16 +01:00
typedef void (*InterruptFunction) ();
class Interrupt
{
public:
static void wakeUp() { wakeUpNow = true; };
2016-05-02 16:39:39 +02:00
static void sleep();
static void setupPinInterrupt(int pin);
2016-07-08 22:14:23 +02:00
static void setupWatchDogInterrupt(int32_t milliseconds);
2016-05-10 13:58:07 +02:00
//static void setupTimerInterrupt(unsigned int milliseconds);
2016-05-02 16:39:39 +02:00
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:
2016-05-02 16:39:39 +02:00
static bool wakeUpNow;
static InterruptFunction pinCallback;
static InterruptFunction wdtCallback;
static void setupWatchDogInterrupt();
// Disable constructors and copy operators
2016-05-02 16:39:39 +02:00
Interrupt() {};
Interrupt(Interrupt const&);
void operator=(Interrupt const&);
2016-02-24 21:51:16 +01:00
};
2016-05-02 16:39:39 +02:00
#endif // INTERRUPT_H