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/4123/head
parent
067fe9b0e5
commit
fd7ecda387
|
@ -27,7 +27,7 @@ CAN::CAN(PinName rd, PinName td) : _can(), _irq() {
|
|||
// No lock needed in constructor
|
||||
|
||||
for (int i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
|
||||
_irq[i].attach(donothing);
|
||||
_irq[i] = callback(donothing);
|
||||
}
|
||||
|
||||
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) {
|
||||
lock();
|
||||
if (func) {
|
||||
_irq[(CanIrqType)type].attach(func);
|
||||
_irq[(CanIrqType)type] = func;
|
||||
can_irq_set(&_can, (CanIrqType)type, 1);
|
||||
} else {
|
||||
_irq[(CanIrqType)type].attach(donothing);
|
||||
_irq[(CanIrqType)type] = callback(donothing);
|
||||
can_irq_set(&_can, (CanIrqType)type, 0);
|
||||
}
|
||||
unlock();
|
||||
|
|
Loading…
Reference in New Issue