I'm using the GxEPD2 library to communicate with an E-Paper display. I now wanted to use the drawPaged method of this library with an object display.

I also have written my own class from which I want to print stuff on the display.

Here's the relevant code for the MyClass.h:

class MyClass{
    //some variables and methods
    void drawClass(); //this is public
    void drawClassCallback(const void* v1); //this is private
    //    this is actually a uint8_t --^

And here's the MyClass.cpp:

void MyClass::drawClass(){
    //some display preparation
    uint8_t var; //A variable to pass information from the callback to this method since it is needed later
    display.drawPaged(std::bind(&MyClass::drawClassCallback, this, &var));
    //some code where I need var with info from the callback

I'm getting the following error:

no matching function for call to 'GxEPD2_BW::drawPaged(std::_Bind_helper::type)'

note: candidate: void GxEPD2_BW::drawPaged(void ()(const void), const void*) [with GxEPD2_Type = GxEPD2_290; short unsigned int page_height = 296u] void drawPaged(void (drawCallback)(const void), const void* pv)

I've also tried display.drawPaged(std::bind(&MyClass::drawClassCallback, this, std::placeholders::_1), &var) without success.

I've stumbled upon this post already, however the solution presented there (and the one used above) does not work in this case.

Why is that?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.