Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.
Dependents: 1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB
Fork of mbed by
Diff: CAN.h
- Revision:
- 22:9114680c05da
- Parent:
- 21:3944f1e2fa4f
- Child:
- 27:7110ebee3484
--- 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