2020-08-23 15:14:04 +02:00
|
|
|
// This file is copied from https://github.com/davidcutting42/ArduinoTimers
|
|
|
|
// All Credit to David Cutting
|
|
|
|
|
|
|
|
#include <Arduino.h>
|
|
|
|
|
2020-11-16 00:21:25 +01:00
|
|
|
#if defined(ARDUINO_AVR_MEGA) || defined(ARDUINO_AVR_MEGA2560)
|
2020-08-23 15:14:04 +02:00
|
|
|
|
|
|
|
#include "ATMEGA2560/Timer.h"
|
|
|
|
|
|
|
|
Timer TimerA(1);
|
|
|
|
Timer TimerB(3);
|
|
|
|
Timer TimerC(4);
|
|
|
|
Timer TimerD(5);
|
|
|
|
|
|
|
|
ISR(TIMER1_OVF_vect)
|
|
|
|
{
|
|
|
|
TimerA.isrCallback();
|
|
|
|
}
|
|
|
|
|
|
|
|
ISR(TIMER3_OVF_vect)
|
|
|
|
{
|
|
|
|
TimerB.isrCallback();
|
|
|
|
}
|
|
|
|
|
|
|
|
ISR(TIMER4_OVF_vect)
|
|
|
|
{
|
|
|
|
TimerC.isrCallback();
|
|
|
|
}
|
|
|
|
|
|
|
|
ISR(TIMER5_OVF_vect)
|
|
|
|
{
|
|
|
|
TimerD.isrCallback();
|
|
|
|
}
|
|
|
|
|
2020-12-09 12:57:38 +01:00
|
|
|
#elif defined(ARDUINO_ARCH_MEGAAVR) // Todo: add other 328 boards for compatibility
|
|
|
|
|
|
|
|
#include "ATMEGA4809/Timer.h"
|
|
|
|
|
|
|
|
Timer TimerA(1);
|
|
|
|
|
|
|
|
|
|
|
|
ISR(TIMER1_OVF_vect)
|
|
|
|
{
|
|
|
|
TimerA.isrCallback();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-08-23 15:14:04 +02:00
|
|
|
#elif defined(ARDUINO_AVR_UNO) // Todo: add other 328 boards for compatibility
|
|
|
|
|
|
|
|
#include "ATMEGA328/Timer.h"
|
|
|
|
|
|
|
|
Timer TimerA(1);
|
|
|
|
Timer TimerB(2);
|
|
|
|
|
|
|
|
ISR(TIMER1_OVF_vect)
|
|
|
|
{
|
|
|
|
TimerA.isrCallback();
|
|
|
|
}
|
|
|
|
|
|
|
|
ISR(TIMER2_OVF_vect)
|
|
|
|
{
|
|
|
|
TimerB.isrCallback();
|
|
|
|
}
|
|
|
|
|
2020-12-08 20:42:21 +01:00
|
|
|
#elif defined(ARDUINO_AVR_UNO_WIFI_REV2)
|
|
|
|
|
|
|
|
#include "ATMEGA4809/Timer.h"
|
|
|
|
|
|
|
|
Timer TimerA(0);
|
|
|
|
|
|
|
|
ISR(TCA0_OVF_vect) {
|
|
|
|
TimerA.isrCallback();
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|