Skip to content

PushButton instance #2

@ilhamikivrak

Description

@ilhamikivrak

Instead of arduino style declaration of Push button,
I would like to suggest such thing below:

The problem I have is that, I can not use const global variable inside my structures.

stPushButton_t* pushButton_getInstance(void)
{
static stPushButton_t* me = NULL;
static stPushButton_t pushButton;

if(NULL == me) /Singleton creation/
{
me = &pushButton;
me->init = init;
me->loop = loop;
me->register_button = register_button;
me->signal_state_change = signal_state_change;
}

return me;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions