A program that shows the use of $Sub$$ and $Super$$ to replace symbols at link time

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
chris
Date:
Thu Sep 20 11:52:48 2012 +0000
Commit message:
Published version;

Changed in this revision

function.cpp Show annotated file Show diff for this revision Revisions of this file
function.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /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
--- /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
--- /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);
+    }
+}
--- /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