template<class retT, class argT>
class FP< retT, argT >
API abstraction for a Function Pointers.
Example using the FP Class with global functions
#include "mbed.h"
DigitalOut myled(LED1);
void handler(bool value)
{
myled = value;
return;
}
int main()
{
while(1)
{
fp(1);
fp(0);
}
}
Core Utility - Templated Function Pointer Class.
API abstraction for a Function Pointers.
void attach(T *item, retT(T::*method)(argT))
Example using the FP Class with different class member functions
#include "mbed.h"
DigitalOut myled(LED4);
class Wrapper
{
public:
Wrapper(){}
void handler(bool value)
{
myled = value;
return;
}
};
int main()
{
Wrapper wrapped;
fp.
attach(&wrapped, &Wrapper::handler);
while(1)
{
fp(1);
fp(0);
}
}
Example using the FP Class with member FP and member function
#include "mbed.h"
DigitalOut myled(LED2);
class Wrapper
{
public:
Wrapper()
{
fp.
attach(
this, &Wrapper::handler);
}
void handler(bool value)
{
myled = value;
return;
}
};
int main()
{
Wrapper wrapped;
while(1)
{
wrapped.fp(1);
wrapped.fp(0);
}
}
Definition at line 135 of file FP.h.