41#pragma clang diagnostic ignored "-Wc++98-compat"
72 const void* cb_object)
noexcept
74 cb_device_func_ = cb_func;
75 cb_device_object_ = cb_object;
82 cb_endpoint_func_ = cb_func;
83 cb_endpoint_object_ = cb_object;
91 assert (buf !=
nullptr);
92 return do_read_setup_packet (buf);
98 assert (data !=
nullptr);
103 return do_transfer (ep_addr, data, num);
111 if (cb_device_func_ !=
nullptr)
114 cb_device_func_ (cb_device_object_, event);
121 if (cb_endpoint_func_ !=
nullptr)
124 cb_endpoint_func_ (cb_endpoint_object_, ep_addr, event);
void signal_endpoint_event(endpoint_t ep_addr, event_t event) noexcept
Signal USB Endpoint Event.
virtual ~Device() noexcept override
void signal_device_event(event_t event) noexcept
Signal device events.
device::signal_device_event_t cb_device_func_
Pointer to static function that implements the device callback.
return_t read_setup_packet(uint8_t *buf) noexcept
Read setup packet received over Control Endpoint.
return_t transfer(endpoint_t ep_addr, uint8_t *data, std::size_t num) noexcept
Read data from or Write data to USB Endpoint.
void register_device_callback(device::signal_device_event_t cb_func, const void *cb_object=nullptr) noexcept
Register device event callback.
device::signal_endpoint_event_t cb_endpoint_func_
Pointer to static function that implements the endpoint callback.
const void * cb_endpoint_object_
Pointer to object instance associated with the endpoint callback.
void register_endpoint_callback(device::signal_endpoint_event_t cb_func, const void *cb_object=nullptr) noexcept
const void * cb_device_object_
Pointer to object instance associated with the device callback.
int printf(const char *format,...)
Write a formatted string to the trace device.
void(* signal_endpoint_event_t)(const void *object, endpoint_t ep_addr, event_t event)
void(* signal_device_event_t)(const void *object, event_t event)
constexpr return_t RETURN_OK
< Operation succeeded