Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed by
Diff: CAN.h
- Revision:
- 22:9114680c05da
- Parent:
- 21:3944f1e2fa4f
- Child:
- 27:7110ebee3484
diff -r 3944f1e2fa4f -r 9114680c05da CAN.h
--- a/CAN.h Thu Jun 17 16:23:14 2010 +0000
+++ b/CAN.h Thu Jul 08 14:27:15 2010 +0000
@@ -12,6 +12,7 @@
#include "PeripheralNames.h"
#include "can_helper.h"
+#include "FunctionPointer.h"
#include <string.h>
@@ -186,6 +187,14 @@
* To use after error overflow.
*/
void reset();
+
+ /* Function: monitor
+ * Puts or removes the CAN interface into silent monitoring mode
+ *
+ * Variables:
+ * silent - boolean indicating whether to go into silent mode or not
+ */
+ void monitor(bool silent);
/* Function: rderror
* Returns number of read errors to detect read overflow errors.
@@ -196,10 +205,34 @@
* Returns number of write errors to detect write overflow errors.
*/
unsigned char tderror();
+
+ /* Function: attach
+ * Attach a function to call whenever a CAN frame received interrupt is
+ * generated.
+ *
+ * Variables:
+ * fptr - A pointer to a void function, or 0 to set as none
+ */
+ void attach(void (*fptr)(void));
+
+ /* Function attach
+ * Attach a member function to call whenever a CAN frame received interrupt
+ * is generated.
+ *
+ * Variables:
+ * tptr - pointer to the object to call the member function on
+ * mptr - pointer to the member function to be called
+ */
+ template<typename T>
+ void attach(T* tptr, void (T::*mptr)(void));
private:
CANName _id;
+ FunctionPointer _rxirq;
+
+ void setup_interrupt(void);
+ void remove_interrupt(void);
};
} // namespace mbed