Commit 6f4cc344 authored by Dean Camera's avatar Dean Camera
Browse files

Rename TOTAL_NUM_CONFIGURATIONS to FIXED_NUM_CONFIGURATIONS, to match the...

Rename TOTAL_NUM_CONFIGURATIONS to FIXED_NUM_CONFIGURATIONS, to match the existing FIXED_CONTROL_ENDPOINT_SIZE compile time option. Add FIXED_NUM_CONFIGURATIONS to the descriptors of each project using the option.
parent bbf89d81
......@@ -75,15 +75,14 @@ int main(void)
uint8_t ConfigDescriptorData[512];
if ((USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, NULL) != HOST_SENDCONTROL_Successful) ||
(ConfigDescriptorSize > sizeof(ConfigDescriptorData)))
(ConfigDescriptorSize > sizeof(ConfigDescriptorData)) ||
(USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData)))
{
printf("Error Retrieving Configuration Descriptor.\r\n");
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
break;
}
USB_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData);
if (HID_Host_ConfigurePipes(&Mouse_HID_Interface,
ConfigDescriptorSize, ConfigDescriptorData) != HID_ENUMERROR_NoError)
......
......@@ -61,7 +61,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.ProductStrIndex = 0x02,
.SerialNumStrIndex = NO_DESCRIPTOR,
.NumberOfConfigurations = 1
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
......
......@@ -136,8 +136,8 @@ void HID_Device_ProcessControlPacket(USB_ClassInfo_HID_Device_t* const HIDInterf
bool HID_Device_ConfigureEndpoints(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
{
memset(&HIDInterfaceInfo->State, 0x00, sizeof(HIDInterfaceInfo->State));
HIDInterfaceInfo->State.IdleCount = 500;
HIDInterfaceInfo->State.UsingReportProtocol = true;
HIDInterfaceInfo->State.IdleCount = 500;
if (!(Endpoint_ConfigureEndpoint(HIDInterfaceInfo->Config.ReportINEndpointNumber, EP_TYPE_INTERRUPT,
ENDPOINT_DIR_IN, HIDInterfaceInfo->Config.ReportINEndpointSize, ENDPOINT_BANK_SINGLE)))
......
......@@ -141,8 +141,8 @@ static void USB_Device_SetConfiguration(void)
{
bool AlreadyConfigured = (USB_ConfigurationNumber != 0);
#if defined(TOTAL_NUM_CONFIGURATIONS)
if ((uint8_t)USB_ControlRequest.wValue > TOTAL_NUM_CONFIGURATIONS)
#if defined(FIXED_NUM_CONFIGURATIONS)
if ((uint8_t)USB_ControlRequest.wValue > FIXED_NUM_CONFIGURATIONS)
return;
#else
#if !defined(USE_FLASH_DESCRIPTORS) && !defined(USE_EEPROM_DESCRIPTORS) && !defined(USE_RAM_DESCRIPTORS)
......
......@@ -51,7 +51,7 @@
/* Public Interface - May be used in end-application: */
/* Macros: */
#if defined(USE_SINGLE_DEVICE_CONFIGURATION)
#define TOTAL_NUM_CONFIGURATIONS 1
#define FIXED_NUM_CONFIGURATIONS 1
#endif
/* Enums: */
......
......@@ -29,7 +29,7 @@
* - Added new FAST_STREAM_TRANSFERS compile time option for faster stream transfers via multiple bytes copied per stream loop
* - Added stdio stream demo code to the CDC device demos, to show how to create standard streams out of the virtual serial ports
* - Added new EEPROM and FLASH buffer versions of the Endpoint and Pipe stream functions
* - Added new USE_FLASH_DESCRIPTORS and TOTAL_NUM_CONFIGURATIONS compile time options
* - Added new USE_FLASH_DESCRIPTORS and FIXED_NUM_CONFIGURATIONS compile time options
* - Added support for the new ATMEGA32U2, ATMEGA16U2 and ATMEGA8U2 AVR models
* - Added new USB_DeviceState variable to keep track of the current Device mode USB state
* - Added new LEDs_ToggleLEDs() function to the LEDs driver
......@@ -57,6 +57,7 @@
* - Internal per-device preprocessing conditions changed to per-device series rather than per-controller group for finer-grain
* internal control
* - Interrupts are no longer disabled during the processing of Control Requests on the default endpoint while in device mode
* - AudioOutput demos now always output to board LEDs, regardless of output mode (removed AUDIO_OUT_LEDS project option)
*
* <b>Fixed:</b>
* - Changed bootloaders to use FLASHEND rather than the existence of RAMPZ to determine if far FLASH pointers are needed to fix
......
......@@ -109,7 +109,7 @@
* reserved for application use. When defined, the corresponding GPIOR register should not be used within the user application except
* implicitly via the library APIs.
*
* <b>TOTAL_NUM_CONFIGURATIONS</b> - ( \ref Group_Device ) \n
* <b>FIXED_NUM_CONFIGURATIONS</b> - ( \ref Group_Device ) \n
* By default, the library determines the number of configurations a USB device supports by reading the device descriptor. This reduces
* the amount of configuration required to set up the library, and allows the value to change dynamically (if descriptors are stored in
* EEPROM or RAM rather than flash memory) and reduces code maintenance. However, this value may be fixed via this token in the project
......
......@@ -61,7 +61,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
.NumberOfConfigurations = 1
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
......
......@@ -126,7 +126,7 @@ LUFA_PATH = ../../
LUFA_OPTS = -D USE_NONSTANDARD_DESCRIPTOR_NAMES
LUFA_OPTS += -D USB_DEVICE_ONLY
LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D TOTAL_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
......
......@@ -95,7 +95,7 @@ USB_Descriptor_Device_t PROGMEM DeviceDescriptor =
.ProductStrIndex = 0x02,
.SerialNumStrIndex = USE_INTERNAL_SERIAL,
.NumberOfConfigurations = 1
.NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS
};
/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage
......
......@@ -126,7 +126,7 @@ LUFA_PATH = ../..
LUFA_OPTS = -D USE_NONSTANDARD_DESCRIPTOR_NAMES
LUFA_OPTS += -D USB_DEVICE_ONLY
LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8
LUFA_OPTS += -D TOTAL_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1
LUFA_OPTS += -D USE_FLASH_DESCRIPTORS
LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment