r89m/PushButton

Error when trying to use it with ESP8266

Closed this issue · 2 comments

First of all, the library is awesome! It works perfectly on Arduino, but when I try to use it in my ESP8266 (ESP-01) I get the following error:

button.ino: In function 'void setup()':
button:16: error: invalid conversion from 'void (*)()' to 'ButtonOnEventCallback {aka void (*)(Button&, short unsigned int)}' [-fpermissive]

button.onHold(5000, onButtonHold);
^

In file included from button.ino:2:0:
Arduino/libraries/r89m_Buttons/src/Button.h:60:28: error: initializing argument 2 of 'CallbackAttachedResponse Button::onHold(uint16_t, ButtonOnEventCallback)' [-fpermissive]
CallbackAttachedResponse onHold(uint16_t, ButtonOnEventCallback);
^
exit status 1
invalid conversion from 'void (*)()' to 'ButtonOnEventCallback {aka void (*)(Button&, short unsigned int)}' [-fpermissive]

Is there a way to make it work in this architecture?
Thanks!

Sorry, my bad!
I just realised that the callback functions have to be declared with the mandatory parameters.
Issue closed.

r89m commented

No problem, glad you got it resolved! (Sorry about the slow response!)