CAN library containing a CAN controller object handling a FIFO, and CAN peripherals attached to it.
Diff: PeripheralCAN.cpp
- Revision:
- 1:b69d05604535
- Child:
- 2:c81dff9c8a93
diff -r ebe6f5e97160 -r b69d05604535 PeripheralCAN.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/PeripheralCAN.cpp Sat Feb 06 14:18:08 2016 +0000 @@ -0,0 +1,34 @@ +#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; +} \ No newline at end of file