Skip to content

Commit fd7ecda

Browse files
authored
Updated CAN to new Callback API
Updated CAN to use new Callback assignment API in order to fix compiler warnings.
1 parent 067fe9b commit fd7ecda

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/CAN.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ CAN::CAN(PinName rd, PinName td) : _can(), _irq() {
2727
// No lock needed in constructor
2828

2929
for (int i = 0; i < sizeof _irq / sizeof _irq[0]; i++) {
30-
_irq[i].attach(donothing);
30+
_irq[i] = callback(donothing);
3131
}
3232

3333
can_init(&_can, rd, td);
@@ -104,10 +104,10 @@ int CAN::filter(unsigned int id, unsigned int mask, CANFormat format, int handle
104104
void CAN::attach(Callback<void()> func, IrqType type) {
105105
lock();
106106
if (func) {
107-
_irq[(CanIrqType)type].attach(func);
107+
_irq[(CanIrqType)type] = func;
108108
can_irq_set(&_can, (CanIrqType)type, 1);
109109
} else {
110-
_irq[(CanIrqType)type].attach(donothing);
110+
_irq[(CanIrqType)type] = callback(donothing);
111111
can_irq_set(&_can, (CanIrqType)type, 0);
112112
}
113113
unlock();

0 commit comments

Comments
 (0)