samd21,samd51,nrf52840: refactor usb initialization

This commit is contained in:
sago35
2022-07-06 07:58:42 +09:00
committed by Ron Evans
parent fcefcb191c
commit 2fa24ef752
9 changed files with 200 additions and 97 deletions
+24
View File
@@ -8,6 +8,12 @@ import (
"runtime/volatile"
)
type USBDevice struct {
}
var (
USBDev = &USBDevice{}
)
var usbDescriptor = descriptorCDC
var (
@@ -47,6 +53,24 @@ var (
usb_STRING_LANGUAGE = [2]uint16{(3 << 8) | (2 + 2), 0x0409} // English
)
var (
usbEndpointDescriptors [8]usbDeviceDescriptor
udd_ep_in_cache_buffer [7][128]uint8
udd_ep_out_cache_buffer [7][128]uint8
isEndpointHalt = false
isRemoteWakeUpEnabled = false
endPoints = []uint32{usb_ENDPOINT_TYPE_CONTROL,
(usb_ENDPOINT_TYPE_INTERRUPT | usbEndpointIn),
(usb_ENDPOINT_TYPE_BULK | usbEndpointOut),
(usb_ENDPOINT_TYPE_BULK | usbEndpointIn)}
usbConfiguration uint8
usbSetInterface uint8
usbLineInfo = cdcLineInfo{115200, 0x00, 0x00, 0x08, 0x00}
)
const (
usb_IMANUFACTURER = 1
usb_IPRODUCT = 2