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

Support std::function for callback. #2

Merged
merged 1 commit into from
Oct 29, 2018
Merged

Support std::function for callback. #2

merged 1 commit into from
Oct 29, 2018

Conversation

kekyo
Copy link
Contributor

@kekyo kekyo commented Oct 4, 2018

Worked on my ESP8266 environment ;)

class PedestrianSignalButton
{
    // suppressed...

    void requested()
    {
        digitalWrite(PUMPED, HIGH);
        pPlayer->play(WAIT_SOUND);
        delay(500);
    }

public:
    // suppressed...

    void Init(DFRobotDFPlayerMini* pPlayer)
    {
        this->pPlayer = pPlayer;

        // Use std::function for callback the class member.
        requestButton.onPressed([&]() { requested(); });
        requestButton.begin();
    }

@evert-arias evert-arias merged commit 108f4e8 into evert-arias:master Oct 29, 2018
@evert-arias
Copy link
Owner

@kekyo Hi. I'm sorry for the delay. Your pull-request has been merged to the master branch.
Thank you very much for your collaboration.

Best regards

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

Successfully merging this pull request may close these issues.

2 participants