Chris Styles
/
sub_super_functions
A program that shows the use of $Sub$$ and $Super$$ to replace symbols at link time
Revision 0:1ec2d1478b47, committed 2012-09-20
- Comitter:
- chris
- Date:
- Thu Sep 20 11:52:48 2012 +0000
- Commit message:
- Published version;
Changed in this revision
diff -r 000000000000 -r 1ec2d1478b47 function.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/function.cpp Thu Sep 20 11:52:48 2012 +0000 @@ -0,0 +1,7 @@ +#include "function.h" +#include "mbed.h" + +void function (int i) { + DigitalOut led(LED1); + led=i; +} \ No newline at end of file
diff -r 000000000000 -r 1ec2d1478b47 function.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/function.h Thu Sep 20 11:52:48 2012 +0000 @@ -0,0 +1,1 @@ +void function (int i); \ No newline at end of file
diff -r 000000000000 -r 1ec2d1478b47 main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Sep 20 11:52:48 2012 +0000 @@ -0,0 +1,21 @@ +#include "mbed.h" +#include "function.h" + +extern void $Super$$function(int i); + +void $Sub$$function (int i) { + DigitalOut led(LED3); + led=i; + wait(0.1); + $Super$$function(i); +} + +int main() { + + while(1) { + function(1); + wait(0.5); + function(0); + wait(0.5); + } +}
diff -r 000000000000 -r 1ec2d1478b47 mbed.bld --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Thu Sep 20 11:52:48 2012 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/cd19af002ccc \ No newline at end of file