mirror of
https://github.com/arduino/Arduino.git
synced 2025-02-26 20:54:22 +01:00
add numInterfaces field to PUSBCallbacks
This commit is contained in:
parent
a031921708
commit
f37547e8fd
@ -95,13 +95,13 @@ int8_t PUSB_AddFunction(PUSBCallbacks *cb, u8* interface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
*interface = lastIf;
|
*interface = lastIf;
|
||||||
lastIf++;
|
lastIf += cb->numInterfaces;
|
||||||
for ( u8 i = 0; i< cb->numEndpoints; i++) {
|
for ( u8 i = 0; i< cb->numEndpoints; i++) {
|
||||||
_initEndpoints[lastEp] = cb->endpointType[i];
|
_initEndpoints[lastEp] = cb->endpointType[i];
|
||||||
lastEp++;
|
lastEp++;
|
||||||
}
|
}
|
||||||
modules_count++;
|
modules_count++;
|
||||||
return lastEp-1;
|
return lastEp - cb->numEndpoints;
|
||||||
// restart USB layer???
|
// restart USB layer???
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,6 +31,7 @@ typedef struct
|
|||||||
int8_t (*getInterface)(u8* interfaceNum);
|
int8_t (*getInterface)(u8* interfaceNum);
|
||||||
int8_t (*getDescriptor)(int8_t t);
|
int8_t (*getDescriptor)(int8_t t);
|
||||||
int8_t numEndpoints;
|
int8_t numEndpoints;
|
||||||
|
int8_t numInterfaces;
|
||||||
u8 endpointType[];
|
u8 endpointType[];
|
||||||
} PUSBCallbacks;
|
} PUSBCallbacks;
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ extern const u16 STRING_LANGUAGE[] PROGMEM;
|
|||||||
extern const u8 STRING_PRODUCT[] PROGMEM;
|
extern const u8 STRING_PRODUCT[] PROGMEM;
|
||||||
extern const u8 STRING_MANUFACTURER[] PROGMEM;
|
extern const u8 STRING_MANUFACTURER[] PROGMEM;
|
||||||
extern const DeviceDescriptor USB_DeviceDescriptor PROGMEM;
|
extern const DeviceDescriptor USB_DeviceDescriptor PROGMEM;
|
||||||
extern const DeviceDescriptor USB_DeviceDescriptorA PROGMEM;
|
|
||||||
extern const DeviceDescriptor USB_DeviceDescriptorB PROGMEM;
|
extern const DeviceDescriptor USB_DeviceDescriptorB PROGMEM;
|
||||||
|
|
||||||
const u16 STRING_LANGUAGE[2] = {
|
const u16 STRING_LANGUAGE[2] = {
|
||||||
@ -72,9 +71,6 @@ const u8 STRING_MANUFACTURER[] PROGMEM = USB_MANUFACTURER;
|
|||||||
const DeviceDescriptor USB_DeviceDescriptor =
|
const DeviceDescriptor USB_DeviceDescriptor =
|
||||||
D_DEVICE(0x00,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);
|
D_DEVICE(0x00,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);
|
||||||
|
|
||||||
const DeviceDescriptor USB_DeviceDescriptorA =
|
|
||||||
D_DEVICE(DEVICE_CLASS,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);
|
|
||||||
|
|
||||||
const DeviceDescriptor USB_DeviceDescriptorB =
|
const DeviceDescriptor USB_DeviceDescriptorB =
|
||||||
D_DEVICE(0xEF,0x02,0x01,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);
|
D_DEVICE(0xEF,0x02,0x01,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);
|
||||||
|
|
||||||
|
@ -120,6 +120,7 @@ int8_t HID_Plug(void)
|
|||||||
cb.getInterface = &HID_GetInterface;
|
cb.getInterface = &HID_GetInterface;
|
||||||
cb.getDescriptor = &HID_GetDescriptor;
|
cb.getDescriptor = &HID_GetDescriptor;
|
||||||
cb.numEndpoints = 1;
|
cb.numEndpoints = 1;
|
||||||
|
cb.numInterfaces = 1;
|
||||||
cb.endpointType[0] = EP_TYPE_INTERRUPT_IN;
|
cb.endpointType[0] = EP_TYPE_INTERRUPT_IN;
|
||||||
HID_ENDPOINT_INT = PUSB_AddFunction(&cb, &HID_INTERFACE);
|
HID_ENDPOINT_INT = PUSB_AddFunction(&cb, &HID_INTERFACE);
|
||||||
|
|
||||||
|
@ -179,6 +179,7 @@ int8_t MIDI_plug(void)
|
|||||||
cb.getInterface = &MIDI_GetInterface;
|
cb.getInterface = &MIDI_GetInterface;
|
||||||
cb.getDescriptor = &MIDI_GetDescriptor;
|
cb.getDescriptor = &MIDI_GetDescriptor;
|
||||||
cb.numEndpoints = 2;
|
cb.numEndpoints = 2;
|
||||||
|
cb.numInterfaces = 2;
|
||||||
cb.endpointType[0] = EP_TYPE_BULK_OUT_MIDI; // MIDI_ENDPOINT_OUT
|
cb.endpointType[0] = EP_TYPE_BULK_OUT_MIDI; // MIDI_ENDPOINT_OUT
|
||||||
cb.endpointType[1] = EP_TYPE_BULK_IN_MIDI; // MIDI_ENDPOINT_IN
|
cb.endpointType[1] = EP_TYPE_BULK_IN_MIDI; // MIDI_ENDPOINT_IN
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user