Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nrf52 'NOT_AN_INTERRUPT' was not declared in this scope #50

Open
packetloss69 opened this issue Nov 28, 2020 · 2 comments
Open

nrf52 'NOT_AN_INTERRUPT' was not declared in this scope #50

packetloss69 opened this issue Nov 28, 2020 · 2 comments

Comments

@packetloss69
Copy link

packetloss69 commented Nov 28, 2020

Hi there.
Issue: When using EasyButton > 1.02 compilation failure with Adafruit nrf52 BSP
Using https://github.com/adafruit/Adafruit_nRF52_Arduino BSP.

Arduino 1.8.13
nrf52 BSP versions affected 0.70 - 0.21.0 (All)

Works on all versions: Easybutton 1.0.2
Fails: 1.1.0 up to and including 2.0.1

Error produced:
C:\Users\User\Documents\Arduino\libraries\EasyButton\src\EasyButton.cpp: In member function bool EasyButton::supportsInterrupt(): C:\Users\User\Documents\Arduino\libraries\EasyButton\src\EasyButton.cpp:139:41: error: NOT_AN_INTERRUPT was not declared in this scope 139 | return (digitalPinToInterrupt(_pin) != NOT_AN_INTERRUPT);

Error compiling for board Nordic nRF52840DK (PCA10056).

in EasyButton.cpp:
bool EasyButton::supportsInterrupt() { return (digitalPinToInterrupt(_pin) != NOT_AN_INTERRUPT); }

references:
C:\Users\User\AppData\Local\Arduino15\packages\adafruit\hardware\nrf52\0.21.0\cores\nRF5\Arduino.h

contains

#define digitalPinToInterrupt(P) ( P )

Any ideas?

Edited:
Compiles after adding to EasyButton.h
#define NOT_AN_INTERRUPT -1

Is this a vaild workaround as it seems NOT_AN_INTERRUPT -1 is Arduino 1.6 Legacy?

@CSC-Sendance
Copy link

A valid workaround for this that also avoids issues stemming from copying the whole library or trying to update it is including the macro via buildflag: -DNOT_AN_INTERRUPT=-1`

If you are using platformio, edit your platformio.ini 's build variant to include:

build_flags = 
	-DNOT_AN_INTERRUPT=-1 ;

@jonfroehlich
Copy link

Just confirming that this is still an issue with Adafruit Feather nRF52840, Arduino IDE 2.0.3, and EasyButton Version 2.0.1.

c:\Users\jonf\Documents\Arduino\libraries\EasyButton\src\EasyButton.cpp: In member function 'bool EasyButton::supportsInterrupt()':
c:\Users\jonf\Documents\Arduino\libraries\EasyButton\src\EasyButton.cpp:99:41: error: 'NOT_AN_INTERRUPT' was not declared in this scope
   99 |  return (digitalPinToInterrupt(_pin) != NOT_AN_INTERRUPT);

I'm not using interrupts with buttons so I added #define NOT_AN_INTERRUPT -1 to the top of EasyButton.h and that solved it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants