Class designed to store and invoke function pointers and method pointers
Revision 2:6ad01486af99, committed 2011-11-29
- Comitter:
- Blaze513
- Date:
- Tue Nov 29 05:50:25 2011 +0000
- Parent:
- 1:2418b141f599
- Child:
- 3:7e4f282982a6
- Commit message:
- initial release
Changed in this revision
TestClass.h | Show diff for this revision Revisions of this file |
main.cpp | Show diff for this revision Revisions of this file |
mbed.bld | Show diff for this revision Revisions of this file |
--- a/TestClass.h Tue Nov 29 05:44:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,22 +0,0 @@ -#include "GenericFunctionHandler.h" -#include "mbed.h" - -class TestClass -{ -private: - GenericFunctionHandler instance; - -public: - TestClass(void) : instance(this, &TestClass::testMfunc1), myComputer(USBTX,USBRX) - { - } - void testMfunc1(void) - { - myComputer.printf("it worked!!! "); - } - void testMfunc2(void) - { - instance(); - } - Serial myComputer; -}; \ No newline at end of file
--- a/main.cpp Tue Nov 29 05:44:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -#include "mbed.h" -#include "TestClass.h" -#include "GenericFunctionHandler.h" - -DigitalOut led1(LED1); -DigitalOut led2(LED2); -DigitalOut led3(LED3); -DigitalOut led4(LED4); -extern "C" void testfunc1(void) -{ - while (1) - { - led1 = !led1; - wait_ms(250); - led2 = !led2; - wait_ms(250); - led3 = !led3; - wait_ms(250); - led4 = !led4; - wait_ms(250); - } -} - -GenericFunctionHandler TestInst1(&testfunc1); -TestClass TestInst2; - -int main() -{ - TestInst2.testMfunc2(); - TestInst1(); -} \ No newline at end of file
--- a/mbed.bld Tue Nov 29 05:44:40 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912