Skip to content

Commit

Permalink
Hack: add digitalPinToInterrupt macro
Browse files Browse the repository at this point in the history
  • Loading branch information
TheLastGimbus authored Jan 30, 2022
1 parent 6b5da60 commit 32e1d89
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/EasyButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@
#include <Arduino.h>
#include "EasyButtonBase.h"

/// ################## HACK ################## ///
#ifndef digitalPinToInterrupt
#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__)
#define digitalPinToInterrupt(p) ((p) == 8 ? 0 : NOT_AN_INTERRUPT)
#elif defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__)
#define digitalPinToInterrupt(p) ((p) == 2 ? 0 : NOT_AN_INTERRUPT)
#else
#error digitalPinToInterrupt() not available for this platform
#endif
#endif
/// ################## HACK ################## ///

#define EASYBUTTON_READ_TYPE_INTERRUPT 0
#define EASYBUTTON_READ_TYPE_POLL 1

Expand Down Expand Up @@ -42,4 +54,4 @@ class EasyButton : public EasyButtonBase
virtual bool _readPin(); // Abstracts the pin value reading.
};

#endif
#endif

0 comments on commit 32e1d89

Please sign in to comment.