CAN library containing a CAN controller object handling a FIFO, and CAN peripherals attached to it.
Diff: PeripheralCAN.h
- Revision:
- 1:b69d05604535
- Child:
- 3:e6f72461e31f
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PeripheralCAN.h Sat Feb 06 14:18:08 2016 +0000 @@ -0,0 +1,66 @@ +#ifndef PeripheralCAN_H +#define PeripheralCAN_H + +#include "mbed.h" +#include <vector> +#include "ControllerCAN.h" + +class ControllerCAN; +/** My CAN Peripheral class + * Used as interface to create CAN Peripheral objets + * + * Examples : + * @code + * @endcode + */ +class PeripheralCAN { + public : + /** Create PeripheralCAN instance + */ + PeripheralCAN(); + + /** Create PeripheralCAN instance + * + * @param controller ControllerCAN instance controlling the PerpiherialCAN + */ + PeripheralCAN(ControllerCAN* controller); + + /** Initialize the instance + */ + virtual void init(void); + + /** Update the PeripheriamCAN instance + * + * @param Id Message Id to determine which variables are concerned, + * @param msg CANMessage instance containing data of interest + */ + virtual void update(const unsigned short& Id, const CANMessage& msg); + + /** Add an Id to the Id vector containing Ids of incoming message + * concerning the current instance + * + * @param Id Message Id to be added + */ + void addIdRead(unsigned short* Id); + + /** Write a message on CAN Bus + * + * @param Id Id message + * @param data char array containing data to be send + * @param len size of the data array + */ + void writeOnCAN(unsigned short Id, const char *data, char len); + //short readOnCAN(unsigned short Id, CANMessage& msg); + + /** Get the IdsRead vector + * + * @returns IdsRead vector + */ + vector<unsigned short*> getIdsRead(void); + + private : + vector<unsigned short*> IdsRead; + ControllerCAN* controllerCAN; +}; + +#endif \ No newline at end of file