FPointer - A callback system that allows for 32bit unsigned ints to be passed to and from the callback.

Dependents:   FYPFinalProgram FYPFinalizeProgram KEYS SaveKeypad ... more

Revision:
1:d7803001a259
Parent:
0:fcfb13f40846
--- a/example3.h	Tue Jan 18 17:31:19 2011 +0000
+++ b/example3.h	Tue Jan 18 22:40:19 2011 +0000
@@ -1,5 +1,5 @@
 /*
-    Copyright (c) 2010 Andy Kirkham
+    Copyright (c) 2011 Andy Kirkham
  
     Permission is hereby granted, free of charge, to any person obtaining a copy
     of this software and associated documentation files (the "Software"), to deal
@@ -39,11 +39,11 @@
     float   f_value;
 } MYDATA;
 
-// The call back function. 
+// The callback function. 
 uint32_t myCallback(uint32_t value) {
 
     // Get the value of the count in main
-    // (deference it) so we know what it is.
+    // (de-reference it) so we know what it is.
     // Note, Mbed/LPC17xx pointers are 32bit
     // values. So we can "cast" a value back
     // into a pointer.
@@ -62,7 +62,7 @@
     // What we return doesn't matter as it's
     // not used in this example but we return
     // "something" (zero in this case) to keep
-    // teh compiler happy as it expects us to
+    // the compiler happy as it expects us to
     // return something.
     return 0;
 }
@@ -80,7 +80,7 @@
     while(1) {
         wait(0.5);
         
-        // Make the callback passing a pointer
+        // Make the callback passing a pointer (& means "address of")
         // to the data structure "data".
         myPointer.call((uint32_t)&data);