CAN library containing a CAN controller object handling a FIFO, and CAN peripherals attached to it.
PeripheralCAN.cpp
- Committer:
- garivetm
- Date:
- 2016-02-06
- Revision:
- 1:b69d05604535
- Child:
- 2:c81dff9c8a93
File content as of revision 1:b69d05604535:
#include "mbed.h" #include "PeripheralCAN.h" //ControllerCAN PeripheralCAN::controllerCAN; PeripheralCAN::PeripheralCAN(){ } PeripheralCAN::PeripheralCAN(ControllerCAN* controller) : controllerCAN(controller) { controllerCAN->attach(this); } void PeripheralCAN::addIdRead(unsigned short* Id){ IdsRead.push_back(Id); } void PeripheralCAN::writeOnCAN(unsigned short Id, const char *data, char len){ if (len != 0){ while(!controllerCAN->writeData(Id, data, len)); } else{ while(!controllerCAN->writeRemote(Id)); } } void PeripheralCAN::init(void){ } void PeripheralCAN::update(const unsigned short& Id, const CANMessage& msg){ } vector<unsigned short*> PeripheralCAN::getIdsRead(void){ return IdsRead; }