mirror of https://github.com/ARMmbed/mbed-os.git
Updated CAN to new Callback API
Updated CAN to use new Callback assignment API in order to fix compiler warnings.pull/4209/head
parent
8394968a12
commit
73a46c0e09
|
@ -27,7 +27,7 @@ CAN::CAN(PinName rd, PinName td) : _can(), _irq() {
|
||||||
// No lock needed in constructor
|
// No lock needed in constructor
|
||||||
|
|
||||||
for (int i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
|
for (int i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
|
||||||
_irq[i].attach(donothing);
|
_irq[i] = callback(donothing);
|
||||||
}
|
}
|
||||||
|
|
||||||
can_init(&_can, rd, td);
|
can_init(&_can, rd, td);
|
||||||
|
@ -104,10 +104,10 @@ int CAN::filter(unsigned int id, unsigned int mask, CANFormat format, int handle
|
||||||
void CAN::attach(Callback<void()> func, IrqType type) {
|
void CAN::attach(Callback<void()> func, IrqType type) {
|
||||||
lock();
|
lock();
|
||||||
if (func) {
|
if (func) {
|
||||||
_irq[(CanIrqType)type].attach(func);
|
_irq[(CanIrqType)type] = func;
|
||||||
can_irq_set(&_can, (CanIrqType)type, 1);
|
can_irq_set(&_can, (CanIrqType)type, 1);
|
||||||
} else {
|
} else {
|
||||||
_irq[(CanIrqType)type].attach(donothing);
|
_irq[(CanIrqType)type] = callback(donothing);
|
||||||
can_irq_set(&_can, (CanIrqType)type, 0);
|
can_irq_set(&_can, (CanIrqType)type, 0);
|
||||||
}
|
}
|
||||||
unlock();
|
unlock();
|
||||||
|
|
Loading…
Reference in New Issue