I use a library which has these definitions
typedef void (*CallbackFunction) (ESPRotary&);
void ESPRotary::setChangedHandler(CallbackFunction f) { ... }
When I try to use the setChangedHandler
function I get an issue that the definition of my callback is wrong.
#pragma once
#include "ESPRotary.h"
class MyUsermod : public Usermod
{
private:
ESPRotary r = ESPRotary(13, 12);
public:
void rotate(ESPRotary &r)
{
Serial.println(r.getPosition());
}
void setup()
{
// argument of type "void (MyUsermod::*)(ESPRotary &r)" is incompatible
// with parameter of type "ESPRotary::CallbackFunction"C/C++(167)
r.setChangedHandler(rotate);
}
};
What am I doing wrong?