Hi all I have a button debounce routine "buttonReallyPressed()"in Arduino that I am reusing for more buttons like this:
typedef int (*ButtonDebounceFunction) ( int arg1);
int buttonReallyPressed(int i);
ButtonDebounceFunction Button1Pressed = buttonReallyPressed;
ButtonDebounceFunction Button2Pressed = buttonReallyPressed;
Inside buttonReallyPressed function I have a "static" variable that remembers the state of the button between succsesive calls.
This doesn't work though because it looks like I am not getting a new instance of the function for each declaration.
Do I need to make some sort of a new() statement?
typedef int (*ButtonDebounceFunction) ( int arg1);
int buttonReallyPressed(int i);
ButtonDebounceFunction Button1Pressed = buttonReallyPressed;
ButtonDebounceFunction Button2Pressed = buttonReallyPressed;
Inside buttonReallyPressed function I have a "static" variable that remembers the state of the button between succsesive calls.
This doesn't work though because it looks like I am not getting a new instance of the function for each declaration.
Do I need to make some sort of a new() statement?