Skip to content

Commit 710af8f

Browse files
committed
Add deprecation note to CAN attach
attach members not using Callback class are not compatible with const and volatile types. This was missed when callback was initially added
1 parent 26b9a1f commit 710af8f

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

drivers/CAN.h

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,17 @@ class CAN {
224224
* @param obj pointer to the object to call the member function on
225225
* @param method pointer to the member function to be called
226226
* @param type Which CAN interrupt to attach the member function to (CAN::RxIrq for message received, TxIrq for transmitted or aborted, EwIrq for error warning, DoIrq for data overrun, WuIrq for wake-up, EpIrq for error passive, AlIrq for arbitration lost, BeIrq for bus error)
227+
* @deprecated
228+
* The attach function does not support cv-qualifiers. Replaced by
229+
* attach(callback(obj, method), type).
227230
*/
228231
template<typename T>
232+
MBED_DEPRECATED_SINCE("mbed-os-5.1",
233+
"The attach function does not support cv-qualifiers. Replaced by "
234+
"attach(callback(obj, method), type).")
229235
void attach(T* obj, void (T::*method)(), IrqType type=RxIrq) {
230236
// Underlying call thread safe
231-
attach(Callback<void()>(obj, method), type);
237+
attach(callback(obj, method), type);
232238
}
233239

234240
/** Attach a member function to call whenever a CAN frame received interrupt
@@ -237,11 +243,17 @@ class CAN {
237243
* @param obj pointer to the object to call the member function on
238244
* @param method pointer to the member function to be called
239245
* @param type Which CAN interrupt to attach the member function to (CAN::RxIrq for message received, TxIrq for transmitted or aborted, EwIrq for error warning, DoIrq for data overrun, WuIrq for wake-up, EpIrq for error passive, AlIrq for arbitration lost, BeIrq for bus error)
246+
* @deprecated
247+
* The attach function does not support cv-qualifiers. Replaced by
248+
* attach(callback(obj, method), type).
240249
*/
241250
template<typename T>
251+
MBED_DEPRECATED_SINCE("mbed-os-5.1",
252+
"The attach function does not support cv-qualifiers. Replaced by "
253+
"attach(callback(obj, method), type).")
242254
void attach(T* obj, void (*method)(T*), IrqType type=RxIrq) {
243255
// Underlying call thread safe
244-
attach(Callback<void()>(obj, method), type);
256+
attach(callback(obj, method), type);
245257
}
246258

247259
static void _irq_handler(uint32_t id, CanIrqType type);

0 commit comments

Comments
 (0)