Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

USB: add pure specifiers and emit vtable#771

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
facchinm merged 1 commit intoarduino:mainfromardnew:usb-emit-vtable
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletionscores/arduino/USB/PluggableUSBDevice.cpp
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -60,6 +60,10 @@ uint32_t arduino::internal::PluggableUSBModule::write_finish(usb_ep_t endpoint)
return PluggableUSBD().write_finish(endpoint);
}

void arduino::internal::PluggableUSBModule::callback_reset()
{
}

arduino::PluggableUSBDevice::PluggableUSBDevice(uint16_t vendor_id, uint16_t product_id)
: USBDevice(get_usb_phy(), vendor_id, product_id, 1 << 8)
{
Expand Down
28 changes: 19 additions & 9 deletionscores/arduino/USB/PluggableUSBDevice.h
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,6 +38,8 @@ class PluggableUSBModule {
PluggableUSBModule(uint8_t numIfs) :
numInterfaces(numIfs)
{ }
virtual ~PluggableUSBModule()
{ }
void lock();
void unlock();
void assert_locked();
Expand All@@ -49,17 +51,25 @@ class PluggableUSBModule {
uint32_t write_finish(usb_ep_t endpoint);

protected:
virtual const uint8_t *configuration_desc(uint8_t index);
virtual void callback_reset() {};
virtual void callback_state_change(USBDevice::DeviceState new_state);
virtual uint32_t callback_request(const USBDevice::setup_packet_t *setup, USBDevice::RequestResult *result, uint8_t** data);
virtual bool callback_request_xfer_done(const USBDevice::setup_packet_t *setup, bool aborted);
virtual bool callback_set_configuration(uint8_t configuration);
virtual void callback_set_interface(uint16_t interface, uint8_t alternate);
virtual void init(EndpointResolver& resolver);
virtual const uint8_t *string_iinterface_desc();
virtual const uint8_t *configuration_desc(uint8_t index) = 0;
virtual void callback_state_change(USBDevice::DeviceState new_state) = 0;
virtual uint32_t callback_request(const USBDevice::setup_packet_t *setup, USBDevice::RequestResult *result, uint8_t** data) = 0;
virtual bool callback_request_xfer_done(const USBDevice::setup_packet_t *setup, bool aborted) = 0;
virtual bool callback_set_configuration(uint8_t configuration) = 0;
virtual void callback_set_interface(uint16_t interface, uint8_t alternate) = 0;
virtual void init(EndpointResolver& resolver) = 0;
virtual const uint8_t *string_iinterface_desc() = 0;
virtual uint8_t getProductVersion() = 0;

/**
* Non-pure virtual method with a non-inline definition
*
* @note This satisfies all criteria necessary for the compiler to emit a
* vtable, allowing users to safely subclass any of the derived "pluggable"
* USB device classes (USBCDC, USBHID, USBMIDI, etc).
*/
virtual void callback_reset();

uint8_t pluggedInterface;

const uint8_t numInterfaces;
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp