CAN library containing a CAN controller object handling a FIFO, and CAN peripherals attached to it.

Committer:
garivetm
Date:
Sat Feb 06 14:18:08 2016 +0000
Revision:
1:b69d05604535
Child:
3:e6f72461e31f
Naming corrections

Who changed what in which revision?

UserRevisionLine numberNew contents of line
garivetm 1:b69d05604535 1 #ifndef PeripheralCAN_H
garivetm 1:b69d05604535 2 #define PeripheralCAN_H
garivetm 1:b69d05604535 3
garivetm 1:b69d05604535 4 #include "mbed.h"
garivetm 1:b69d05604535 5 #include <vector>
garivetm 1:b69d05604535 6 #include "ControllerCAN.h"
garivetm 1:b69d05604535 7
garivetm 1:b69d05604535 8 class ControllerCAN;
garivetm 1:b69d05604535 9 /** My CAN Peripheral class
garivetm 1:b69d05604535 10 * Used as interface to create CAN Peripheral objets
garivetm 1:b69d05604535 11 *
garivetm 1:b69d05604535 12 * Examples :
garivetm 1:b69d05604535 13 * @code
garivetm 1:b69d05604535 14 * @endcode
garivetm 1:b69d05604535 15 */
garivetm 1:b69d05604535 16 class PeripheralCAN {
garivetm 1:b69d05604535 17 public :
garivetm 1:b69d05604535 18 /** Create PeripheralCAN instance
garivetm 1:b69d05604535 19 */
garivetm 1:b69d05604535 20 PeripheralCAN();
garivetm 1:b69d05604535 21
garivetm 1:b69d05604535 22 /** Create PeripheralCAN instance
garivetm 1:b69d05604535 23 *
garivetm 1:b69d05604535 24 * @param controller ControllerCAN instance controlling the PerpiherialCAN
garivetm 1:b69d05604535 25 */
garivetm 1:b69d05604535 26 PeripheralCAN(ControllerCAN* controller);
garivetm 1:b69d05604535 27
garivetm 1:b69d05604535 28 /** Initialize the instance
garivetm 1:b69d05604535 29 */
garivetm 1:b69d05604535 30 virtual void init(void);
garivetm 1:b69d05604535 31
garivetm 1:b69d05604535 32 /** Update the PeripheriamCAN instance
garivetm 1:b69d05604535 33 *
garivetm 1:b69d05604535 34 * @param Id Message Id to determine which variables are concerned,
garivetm 1:b69d05604535 35 * @param msg CANMessage instance containing data of interest
garivetm 1:b69d05604535 36 */
garivetm 1:b69d05604535 37 virtual void update(const unsigned short& Id, const CANMessage& msg);
garivetm 1:b69d05604535 38
garivetm 1:b69d05604535 39 /** Add an Id to the Id vector containing Ids of incoming message
garivetm 1:b69d05604535 40 * concerning the current instance
garivetm 1:b69d05604535 41 *
garivetm 1:b69d05604535 42 * @param Id Message Id to be added
garivetm 1:b69d05604535 43 */
garivetm 1:b69d05604535 44 void addIdRead(unsigned short* Id);
garivetm 1:b69d05604535 45
garivetm 1:b69d05604535 46 /** Write a message on CAN Bus
garivetm 1:b69d05604535 47 *
garivetm 1:b69d05604535 48 * @param Id Id message
garivetm 1:b69d05604535 49 * @param data char array containing data to be send
garivetm 1:b69d05604535 50 * @param len size of the data array
garivetm 1:b69d05604535 51 */
garivetm 1:b69d05604535 52 void writeOnCAN(unsigned short Id, const char *data, char len);
garivetm 1:b69d05604535 53 //short readOnCAN(unsigned short Id, CANMessage& msg);
garivetm 1:b69d05604535 54
garivetm 1:b69d05604535 55 /** Get the IdsRead vector
garivetm 1:b69d05604535 56 *
garivetm 1:b69d05604535 57 * @returns IdsRead vector
garivetm 1:b69d05604535 58 */
garivetm 1:b69d05604535 59 vector<unsigned short*> getIdsRead(void);
garivetm 1:b69d05604535 60
garivetm 1:b69d05604535 61 private :
garivetm 1:b69d05604535 62 vector<unsigned short*> IdsRead;
garivetm 1:b69d05604535 63 ControllerCAN* controllerCAN;
garivetm 1:b69d05604535 64 };
garivetm 1:b69d05604535 65
garivetm 1:b69d05604535 66 #endif