CAN library containing a CAN controller object handling a FIFO, and CAN peripherals attached to it.
Diff: ControllerCAN.h
- Revision:
- 2:c81dff9c8a93
- Parent:
- 1:b69d05604535
- Child:
- 3:e6f72461e31f
--- a/ControllerCAN.h Sat Feb 06 14:18:08 2016 +0000 +++ b/ControllerCAN.h Thu Feb 18 15:40:24 2016 +0000 @@ -14,6 +14,41 @@ * * Examples : * @code + * class Motor : public PeripheralCAN{ // Your own Peripheral class (here a motor) + * public : + * Motor(ControllerCAN* controller, unsigned short Id1, unsigned short Id2) : PeripheralCAN(controller), Id1_m(Id1), Id2_m(Id2){ + * // Your stuffs + * }; + * + * void init(void){ + * addIdRead(&Id1); // To be done for each incomming Id + * addIdRead(&Id2); // To be done for each incomming Id + * // Your stuffs + * }; + * + * void update(const unsigned short& Id, const CANMessage& msg){ + * if(Id == Id1){ + * // update your own attributes with msg content + * } + * else if(Id == Id2){ + * // update your own attributes with msg content + * } + * }; + * + * private : + * unsigned short Id1_m; + * unsigned short Id2_m; + * }; + * + * int main(){ + * ControllerCAN controller; + * Motor peripherial(&controller, 0x100, 0x101); + * + * while(1){ + * controller.FIFOread(); // Treatement of the FIFO CAN messages + * // Your stuffs + * } + * } * @endcode */ class ControllerCAN {