2222#include " USBDevice_Types.h"
2323#include " USBPhy.h"
2424#include " mbed_critical.h"
25+ #include " Callback.h"
2526
2627/* *
2728 * \defgroup drivers_USBDevice USBDevice class
@@ -139,7 +140,7 @@ class USBDevice: public USBPhyEvents {
139140 * @param callback Method pointer to be called when a packet is transferred
140141 * @returns true if successful, false otherwise
141142 */
142- bool endpoint_add (usb_ep_t endpoint, uint32_t max_packet, usb_ep_type_t type, ep_cb_t callback = NULL );
143+ bool endpoint_add (usb_ep_t endpoint, uint32_t max_packet, usb_ep_type_t type, mbed::Callback< void ()> callback = NULL);
143144
144145 /* *
145146 * Add an endpoint
@@ -153,7 +154,7 @@ class USBDevice: public USBPhyEvents {
153154 template <typename T>
154155 bool endpoint_add (usb_ep_t endpoint, uint32_t max_packet, usb_ep_type_t type, void (T::*callback)())
155156 {
156- return endpoint_add (endpoint, max_packet, type, static_cast <ep_cb_t >(callback));
157+ return endpoint_add (endpoint, max_packet, type, mbed::callback ( this , static_cast <ep_cb_t >(callback) ));
157158 }
158159
159160 /* *
@@ -540,7 +541,7 @@ class USBDevice: public USBPhyEvents {
540541 void _complete_set_interface ();
541542
542543 struct endpoint_info_t {
543- ep_cb_t callback;
544+ mbed::Callback< void ()> callback;
544545 uint16_t max_packet_size;
545546 uint16_t transfer_size;
546547 uint8_t flags;
0 commit comments