Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
PeripheralCAN.cpp
- Committer:
- garivetm
- Date:
- 2018-05-05
- Revision:
- 4:0ed21bbd917b
- Parent:
- 2:c81dff9c8a93
- Child:
- 5:d1920eb1d63e
File content as of revision 4:0ed21bbd917b:
/***************************************************************************
AUTHORS : BRUNO LARNAUDIE (Main functions) bruno.larnaudie@u-psud.fr
MATHIEU GARIVET (Object Oriented aspect)
*
INSTITUTION : IUT de CACHAN - 9 av. de la div. Leclerc - 94230 CACHAN
VERSIONS : v1 (03/07/2012) : FIFO organisation
v2 (18/02/2016) : Controller aand Peripheral organisation
****************************************************************************
Copyright 2016 LARNAUDIE GARIVET
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
***************************************************************************/
#include "mbed.h"
#include "PeripheralCAN.h"
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;
}