I'm trying to write a generic wait a certain time unless an event happens
function where I can pass in the event happens
function. Here's what I've got so far (simplified).
boolean wait( unsigned long time, boolean(*u)(void))
As an aside, I have created a class called Input
which does similar stuff to the Button class. I want to call the wait function like this example.
wait( 3000, Modeswitch.on );
Modeswitch is instantiated from Input
returns true if conditions in the object are met. I get the following compilation errorerror: argument of type 'boolean (Input:()' does not match 'boolean (*)()'
What am I doing wrong? I've looked at many tutorials on passing objects/functions and I can't work this out.