26#pragma clang diagnostic ignored "-Wc++98-compat"
57 const void* cb_object)
noexcept
59 cb_device_func_ = cb_func;
60 cb_device_object_ = cb_object;
67 cb_endpoint_func_ = cb_func;
68 cb_endpoint_object_ = cb_object;
76 assert (buf !=
nullptr);
77 return do_read_setup_packet (buf);
83 assert (data !=
nullptr);
88 return do_transfer (ep_addr, data, num);
96 if (cb_device_func_ !=
nullptr)
99 cb_device_func_ (cb_device_object_, event);
106 if (cb_endpoint_func_ !=
nullptr)
109 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