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 b38d7f07f0
commit 8fbc30bd8a
3 changed files with 3 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);