mirror of
https://github.com/polhenarejos/pico-rng.git
synced 2026-05-28 17:11:23 +02:00
Updated firware to contain only 1 endpoint. Created a global data buffer to hold the ADC EP1 IN data. This increased performance from 7.5 KBps to 150+ KBps.
This commit is contained in:
@@ -38,8 +38,7 @@ struct usb_device_configuration {
|
||||
|
||||
#define EP0_IN_ADDR (USB_DIR_IN | 0)
|
||||
#define EP0_OUT_ADDR (USB_DIR_OUT | 0)
|
||||
#define EP1_OUT_ADDR (USB_DIR_OUT | 1)
|
||||
#define EP2_IN_ADDR (USB_DIR_IN | 2)
|
||||
#define EP1_IN_ADDR (USB_DIR_IN | 1)
|
||||
|
||||
// EP0 IN and OUT
|
||||
static const struct usb_endpoint_descriptor ep0_out = {
|
||||
@@ -83,26 +82,17 @@ static const struct usb_interface_descriptor interface_descriptor = {
|
||||
.bDescriptorType = USB_DT_INTERFACE,
|
||||
.bInterfaceNumber = 0,
|
||||
.bAlternateSetting = 0,
|
||||
.bNumEndpoints = 2, // Interface has 2 endpoints
|
||||
.bNumEndpoints = 1, // Interface has 1 endpoint
|
||||
.bInterfaceClass = 0xef, // Miscellaneous device. See https://www.usb.org/defined-class-codes.
|
||||
.bInterfaceSubClass = 0,
|
||||
.bInterfaceProtocol = 0,
|
||||
.iInterface = 0
|
||||
};
|
||||
|
||||
static const struct usb_endpoint_descriptor ep1_out = {
|
||||
static const struct usb_endpoint_descriptor ep1_in = {
|
||||
.bLength = sizeof(struct usb_endpoint_descriptor),
|
||||
.bDescriptorType = USB_DT_ENDPOINT,
|
||||
.bEndpointAddress = EP1_OUT_ADDR, // EP number 1, OUT from host (rx to device)
|
||||
.bmAttributes = USB_TRANSFER_TYPE_BULK,
|
||||
.wMaxPacketSize = 64,
|
||||
.bInterval = 0
|
||||
};
|
||||
|
||||
static const struct usb_endpoint_descriptor ep2_in = {
|
||||
.bLength = sizeof(struct usb_endpoint_descriptor),
|
||||
.bDescriptorType = USB_DT_ENDPOINT,
|
||||
.bEndpointAddress = EP2_IN_ADDR, // EP number 2, IN from host (tx from device)
|
||||
.bEndpointAddress = EP1_IN_ADDR, // EP number 1, IN from host (tx from device)
|
||||
.bmAttributes = USB_TRANSFER_TYPE_BULK,
|
||||
.wMaxPacketSize = 64,
|
||||
.bInterval = 0
|
||||
@@ -113,8 +103,7 @@ static const struct usb_configuration_descriptor config_descriptor = {
|
||||
.bDescriptorType = USB_DT_CONFIG,
|
||||
.wTotalLength = (sizeof(config_descriptor) +
|
||||
sizeof(interface_descriptor) +
|
||||
sizeof(ep1_out) +
|
||||
sizeof(ep2_in)),
|
||||
sizeof(ep1_in)),
|
||||
.bNumInterfaces = 1,
|
||||
.bConfigurationValue = 1, // Configuration 1
|
||||
.iConfiguration = 0, // No string
|
||||
|
||||
Reference in New Issue
Block a user