Move out many of the common class driver constants into grouped enums, to make them more managable.

Add new CDC descriptor structs to the CDC class driver, so that the CDC demos can use human readable field names.

Rename prefix for Still Image Host class driver functions from "SImage_" to "SI_" to remain consistent with the rest of the driver.
This commit is contained in:
Dean Camera 2010-09-28 12:14:06 +00:00
parent 800485bd95
commit 713670043a
80 changed files with 924 additions and 766 deletions

View file

@ -53,7 +53,7 @@ USB_ClassInfo_HID_Host_t Joystick_HID_Interface =
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.HIDInterfaceProtocol = HID_NON_BOOT_PROTOCOL,
.HIDInterfaceProtocol = HID_BOOTP_NonBootProtocol,
.HIDParserData = &HIDReportInfo
},
@ -138,7 +138,7 @@ int main(void)
/* Determine what report item is being tested, process updated value as needed */
if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) &&
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))
(ReportItem->ItemType == HID_REPORT_ITEM_In))
{
if (ReportItem->Value)
LEDMask = LEDS_ALL_LEDS;
@ -146,7 +146,7 @@ int main(void)
else if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_GENERIC_DCTRL) &&
((ReportItem->Attributes.Usage.Usage == USAGE_X) ||
(ReportItem->Attributes.Usage.Usage == USAGE_Y)) &&
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))
(ReportItem->ItemType == HID_REPORT_ITEM_In))
{
int16_t DeltaMovement = HID_ALIGN_DATA(ReportItem, int16_t);

View file

@ -50,7 +50,7 @@ USB_ClassInfo_HID_Host_t Keyboard_HID_Interface =
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.HIDInterfaceProtocol = HID_BOOT_KEYBOARD_PROTOCOL,
.HIDInterfaceProtocol = HID_BOOTP_KeyboardBootProtocol,
},
};

View file

@ -53,7 +53,7 @@ USB_ClassInfo_HID_Host_t Keyboard_HID_Interface =
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.HIDInterfaceProtocol = HID_NON_BOOT_PROTOCOL,
.HIDInterfaceProtocol = HID_BOOTP_NonBootProtocol,
.HIDParserData = &HIDReportInfo
},
@ -138,7 +138,7 @@ int main(void)
if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_KEYBOARD) &&
(ReportItem->Attributes.BitSize == 8) &&
(ReportItem->Attributes.Logical.Maximum > 1) &&
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))
(ReportItem->ItemType == HID_REPORT_ITEM_In))
{
/* Key code is an unsigned char in length, cast to the appropriate type */
uint8_t KeyCode = (uint8_t)ReportItem->Value;

View file

@ -50,7 +50,7 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface =
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.HIDInterfaceProtocol = HID_BOOT_MOUSE_PROTOCOL,
.HIDInterfaceProtocol = HID_BOOTP_MouseBootProtocol,
},
};

View file

@ -53,7 +53,7 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Interface =
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.HIDInterfaceProtocol = HID_NON_BOOT_PROTOCOL,
.HIDInterfaceProtocol = HID_BOOTP_NonBootProtocol,
.HIDParserData = &HIDReportInfo
},
@ -138,14 +138,14 @@ int main(void)
/* Determine what report item is being tested, process updated value as needed */
if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_BUTTON) &&
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))
(ReportItem->ItemType == HID_REPORT_ITEM_In))
{
if (ReportItem->Value)
LEDMask = LEDS_ALL_LEDS;
}
else if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_GENERIC_DCTRL) &&
(ReportItem->Attributes.Usage.Usage == USAGE_SCROLL_WHEEL) &&
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))
(ReportItem->ItemType == HID_REPORT_ITEM_In))
{
int16_t WheelDelta = HID_ALIGN_DATA(ReportItem, int16_t);
@ -155,7 +155,7 @@ int main(void)
else if ((ReportItem->Attributes.Usage.Page == USAGE_PAGE_GENERIC_DCTRL) &&
((ReportItem->Attributes.Usage.Usage == USAGE_X) ||
(ReportItem->Attributes.Usage.Usage == USAGE_Y)) &&
(ReportItem->ItemType == REPORT_ITEM_TYPE_In))
(ReportItem->ItemType == HID_REPORT_ITEM_In))
{
int16_t DeltaMovement = HID_ALIGN_DATA(ReportItem, int16_t);

View file

@ -86,8 +86,8 @@ int main(void)
break;
}
if (SImage_Host_ConfigurePipes(&DigitalCamera_SI_Interface,
ConfigDescriptorSize, ConfigDescriptorData) != SI_ENUMERROR_NoError)
if (SI_Host_ConfigurePipes(&DigitalCamera_SI_Interface,
ConfigDescriptorSize, ConfigDescriptorData) != SI_ENUMERROR_NoError)
{
puts_P(PSTR("Attached Device Not a Valid Still Image Class Device.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
@ -110,7 +110,7 @@ int main(void)
case HOST_STATE_Configured:
puts_P(PSTR("Opening Session...\r\n"));
if (SImage_Host_OpenSession(&DigitalCamera_SI_Interface) != PIPE_RWSTREAM_NoError)
if (SI_Host_OpenSession(&DigitalCamera_SI_Interface) != PIPE_RWSTREAM_NoError)
{
puts_P(PSTR("Could not open PIMA session.\r\n"));
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
@ -119,8 +119,8 @@ int main(void)
puts_P(PSTR("Turning off Device...\r\n"));
SImage_Host_SendCommand(&DigitalCamera_SI_Interface, 0x1013, 0, NULL);
if (SImage_Host_ReceiveResponse(&DigitalCamera_SI_Interface))
SI_Host_SendCommand(&DigitalCamera_SI_Interface, 0x1013, 0, NULL);
if (SI_Host_ReceiveResponse(&DigitalCamera_SI_Interface))
{
puts_P(PSTR("Could not turn off device.\r\n"));
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
@ -131,7 +131,7 @@ int main(void)
puts_P(PSTR("Closing Session...\r\n"));
if (SImage_Host_CloseSession(&DigitalCamera_SI_Interface) != PIPE_RWSTREAM_NoError)
if (SI_Host_CloseSession(&DigitalCamera_SI_Interface) != PIPE_RWSTREAM_NoError)
{
puts_P(PSTR("Could not close PIMA session.\r\n"));
USB_HostState = HOST_STATE_WaitForDeviceRemoval;
@ -143,7 +143,7 @@ int main(void)
break;
}
SImage_Host_USBTask(&DigitalCamera_SI_Interface);
SI_Host_USBTask(&DigitalCamera_SI_Interface);
USB_USBTask();
}
}