1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-11-29 10:24:12 +01:00

add numInterfaces field to PUSBCallbacks

This commit is contained in:
Martino Facchin 2015-06-08 17:34:59 +02:00 committed by Cristian Maglie
parent a031921708
commit f37547e8fd
5 changed files with 5 additions and 6 deletions

View File

@ -95,13 +95,13 @@ int8_t PUSB_AddFunction(PUSBCallbacks *cb, u8* interface)
}
*interface = lastIf;
lastIf++;
lastIf += cb->numInterfaces;
for ( u8 i = 0; i< cb->numEndpoints; i++) {
_initEndpoints[lastEp] = cb->endpointType[i];
lastEp++;
}
modules_count++;
return lastEp-1;
return lastEp - cb->numEndpoints;
// restart USB layer???
}

View File

@ -31,6 +31,7 @@ typedef struct
int8_t (*getInterface)(u8* interfaceNum);
int8_t (*getDescriptor)(int8_t t);
int8_t numEndpoints;
int8_t numInterfaces;
u8 endpointType[];
} PUSBCallbacks;

View File

@ -33,7 +33,6 @@ extern const u16 STRING_LANGUAGE[] PROGMEM;
extern const u8 STRING_PRODUCT[] PROGMEM;
extern const u8 STRING_MANUFACTURER[] PROGMEM;
extern const DeviceDescriptor USB_DeviceDescriptor PROGMEM;
extern const DeviceDescriptor USB_DeviceDescriptorA PROGMEM;
extern const DeviceDescriptor USB_DeviceDescriptorB PROGMEM;
const u16 STRING_LANGUAGE[2] = {
@ -72,9 +71,6 @@ const u8 STRING_MANUFACTURER[] PROGMEM = USB_MANUFACTURER;
const DeviceDescriptor USB_DeviceDescriptor =
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 =
D_DEVICE(0xEF,0x02,0x01,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);

View File

@ -120,6 +120,7 @@ int8_t HID_Plug(void)
cb.getInterface = &HID_GetInterface;
cb.getDescriptor = &HID_GetDescriptor;
cb.numEndpoints = 1;
cb.numInterfaces = 1;
cb.endpointType[0] = EP_TYPE_INTERRUPT_IN;
HID_ENDPOINT_INT = PUSB_AddFunction(&cb, &HID_INTERFACE);

View File

@ -179,6 +179,7 @@ int8_t MIDI_plug(void)
cb.getInterface = &MIDI_GetInterface;
cb.getDescriptor = &MIDI_GetDescriptor;
cb.numEndpoints = 2;
cb.numInterfaces = 2;
cb.endpointType[0] = EP_TYPE_BULK_OUT_MIDI; // MIDI_ENDPOINT_OUT
cb.endpointType[1] = EP_TYPE_BULK_IN_MIDI; // MIDI_ENDPOINT_IN