Modified version of Andy Kirkhams FPointer.h http://mbed.org/users/AjK/libraries/FPointer/ll7nhv Advantages: - reduced size of from 12 -> 8 byte by usage of a unnamed union - speedup function call by removing one error check - replaced call() function by () operator - templated: you can define the return and argument types - implementations provided for 1 and 2 arguments, easy extendable to more arguments
main.cpp
- Committer:
- Renegr
- Date:
- 2011-12-11
- Revision:
- 0:e62fc62bc488
File content as of revision 0:e62fc62bc488:
#include "mbed.h" #include "FunctionPointers.h" DigitalOut myled(LED1); FPtr1ArgT<void,int> fp; int main() { fp.attach( myled, &DigitalOut::write); while(1) { fp(1); wait(0.2); fp(0); wait(0.2); } }