34#ifndef CMSIS_PLUS_DRIVER_USB_DEVICE_H_
35#define CMSIS_PLUS_DRIVER_USB_DEVICE_H_
51#pragma GCC diagnostic push
54#pragma clang diagnostic ignored "-Wc++98-compat"
69#pragma GCC diagnostic push
70#pragma GCC diagnostic ignored "-Wpadded"
93#pragma GCC diagnostic pop
98#pragma GCC diagnostic push
99#pragma GCC diagnostic ignored "-Wpadded"
134#pragma GCC diagnostic pop
200#pragma GCC diagnostic push
201#pragma GCC diagnostic ignored "-Wpadded"
236 const
void* cb_object =
nullptr) noexcept;
240 const
void* cb_object =
nullptr) noexcept;
248 const device::Capabilities&
393 virtual const device::Capabilities&
402 virtual device::Status&
456#pragma GCC diagnostic pop
466 Status::is_vbus_on (
void)
const noexcept
472 Status::get_speed (
void)
const noexcept
478 Status::is_active (
void)
const noexcept
564#pragma GCC diagnostic pop
virtual return_t do_stall_endpoint(endpoint_t ep_addr, bool stall) noexcept=0
virtual return_t do_configure_address(device_address_t dev_addr) noexcept=0
virtual std::size_t do_get_transfer_count(endpoint_t ep_addr) noexcept=0
void signal_endpoint_event(endpoint_t ep_addr, event_t event) noexcept
Signal USB Endpoint Event.
return_t connect(void) noexcept
Connect USB Device.
virtual const device::Capabilities & do_get_capabilities(void) noexcept=0
return_t unconfigure_endpoint(endpoint_t ep_addr) noexcept
Unconfigure USB Endpoint.
virtual return_t do_wakeup_remote(void) noexcept=0
virtual return_t do_unconfigure_endpoint(endpoint_t ep_addr) noexcept=0
std::size_t get_transfer_count(endpoint_t ep_addr) noexcept
Get result of USB Endpoint transfer.
virtual ~Device() noexcept override
void signal_device_event(event_t event) noexcept
Signal device events.
virtual frame_number_t do_get_frame_number(void) noexcept=0
device::signal_device_event_t cb_device_func_
Pointer to static function that implements the device callback.
return_t wakeup_remote(void) noexcept
Trigger USB Remote Wakeup.
return_t read_setup_packet(uint8_t *buf) noexcept
Read setup packet received over Control Endpoint.
const device::Capabilities & get_capabilities(void) noexcept
Get driver capabilities.
virtual return_t do_transfer(endpoint_t ep_addr, uint8_t *data, std::size_t num) noexcept=0
virtual return_t do_connect(void) noexcept=0
Device & operator=(const Device &)=delete
virtual return_t do_abort_transfer(endpoint_t ep_addr) noexcept=0
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.
virtual return_t do_configure_endpoint(endpoint_t ep_addr, Endpoint_type ep_type, packet_size_t ep_max_packet_size) noexcept=0
virtual return_t do_read_setup_packet(uint8_t *buf) noexcept=0
virtual return_t do_disconnect(void) noexcept=0
return_t configure_address(device_address_t dev_addr) noexcept
Set USB Device Address.
return_t disconnect(void) noexcept
Disconnect USB Device.
frame_number_t get_frame_number(void) noexcept
Get current USB Frame Number.
void register_endpoint_callback(device::signal_endpoint_event_t cb_func, const void *cb_object=nullptr) noexcept
return_t abort_transfer(endpoint_t ep_addr) noexcept
Abort current USB Endpoint transfer.
const void * cb_device_object_
Pointer to object instance associated with the device callback.
return_t configure_endpoint(endpoint_t ep_addr, Endpoint_type ep_type, packet_size_t ep_max_packet_size) noexcept
Configure USB Endpoint.
device::Status & get_status(void) noexcept
Get current USB Device Status.
virtual device::Status & do_get_status(void) noexcept=0
Device(const Device &)=delete
return_t stall_endpoint(endpoint_t ep_addr, bool stall) noexcept
Set/Clear Stall for USB Endpoint.
USB device driver capabilities.
bool vbus_detection
< VBUS detection
bool event_vbus_on
Signal VBUS Off event.
speed_t get_speed(void) const noexcept
speed_t speed
USB Device active flag.
bool is_vbus_on(void) const noexcept
bool is_active(void) const noexcept
bool vbus
< USB Device VBUS flag
void(* signal_endpoint_event_t)(const void *object, endpoint_t ep_addr, event_t event)
Endpoint_event
USB Device Endpoint Events.
Device_event
USB Device Events.
@ vbus_on
USB Device VBUS On.
@ high_speed
USB Suspend occurred.
@ suspend
USB Resume occurred.
@ reset
USB switch to High Speed occurred.
@ vbus_off
USB Reset occurred.
void(* signal_device_event_t)(const void *object, event_t event)
Endpoint_type
Endpoint type.