aboutsummaryrefslogtreecommitdiffstats
path: root/Demos
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-11-24 01:31:31 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-11-24 01:31:31 +0000
commit7f8dbb4908abd33b5ee8bfba7cc3870fa14f7366 (patch)
tree921ffed6c58a2d54741c54874276798f1577fb9b /Demos
parent8b5aa616013811faf53fb5c1f2fdb819dd671b36 (diff)
downloadlufa-7f8dbb4908abd33b5ee8bfba7cc3870fa14f7366.tar.gz
lufa-7f8dbb4908abd33b5ee8bfba7cc3870fa14f7366.tar.bz2
lufa-7f8dbb4908abd33b5ee8bfba7cc3870fa14f7366.zip
Convert the LowLevel AndroidAccessory demo to use the new class driver constants to reduce code duplication.
Add missing Doxygen documentation.
Diffstat (limited to 'Demos')
-rw-r--r--Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.c14
-rw-r--r--Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.c6
-rw-r--r--Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.h4
-rw-r--r--Demos/Host/LowLevel/AndroidAccessoryHost/DeviceDescriptor.h5
-rw-r--r--Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.c6
-rw-r--r--Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.h23
6 files changed, 13 insertions, 45 deletions
diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.c b/Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.c
index 52ca9101f..7b2b79604 100644
--- a/Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.c
+++ b/Demos/Host/LowLevel/AndroidAccessoryHost/AndroidAccessoryHost.c
@@ -183,7 +183,7 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void)
}
/* Validate the returned protocol version */
- if (AndroidProtocol != ANDROID_PROTOCOL_Accessory)
+ if (AndroidProtocol != AOA_PROTOCOL_AccessoryV1)
{
puts_P(PSTR(ESC_FG_RED "Accessory Mode Not Supported."));
@@ -192,12 +192,12 @@ void EVENT_USB_Host_DeviceEnumerationComplete(void)
}
/* Send the device strings and start the Android Accessory Mode */
- Android_SendString(ANDROID_STRING_Manufacturer, "Dean Camera");
- Android_SendString(ANDROID_STRING_Model, "LUFA Android Demo");
- Android_SendString(ANDROID_STRING_Description, "LUFA Android Demo");
- Android_SendString(ANDROID_STRING_Version, "1.0");
- Android_SendString(ANDROID_STRING_URI, "http://www.lufa-lib.org");
- Android_SendString(ANDROID_STRING_Serial, "0000000012345678");
+ Android_SendString(AOA_STRING_Manufacturer, "Dean Camera");
+ Android_SendString(AOA_STRING_Model, "LUFA Android Demo");
+ Android_SendString(AOA_STRING_Description, "LUFA Android Demo");
+ Android_SendString(AOA_STRING_Version, "1.0");
+ Android_SendString(AOA_STRING_URI, "http://www.lufa-lib.org");
+ Android_SendString(AOA_STRING_Serial, "0000000012345678");
Android_StartAccessoryMode();
return;
diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.c b/Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.c
index 29fbfcaaa..973ac537c 100644
--- a/Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.c
+++ b/Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.c
@@ -123,9 +123,9 @@ uint8_t DCOMP_NextAndroidAccessoryInterface(void* const CurrentDescriptor)
{
USB_Descriptor_Interface_t* Interface = DESCRIPTOR_PCAST(CurrentDescriptor, USB_Descriptor_Interface_t);
- if ((Interface->Class == ANDROID_INTERFACE_CLASS) &&
- (Interface->SubClass == ANDROID_INTERFACE_SUBCLASS) &&
- (Interface->Protocol == ANDROID_INTERFACE_PROTOCOL))
+ if ((Interface->Class == AOA_CSCP_AOADataClass) &&
+ (Interface->SubClass == AOA_CSCP_AOADataSubclass) &&
+ (Interface->Protocol == AOA_CSCP_AOADataProtocol))
{
return DESCRIPTOR_SEARCH_Found;
}
diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.h b/Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.h
index b63cbe4b0..3ec4b78e0 100644
--- a/Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.h
+++ b/Demos/Host/LowLevel/AndroidAccessoryHost/ConfigDescriptor.h
@@ -42,10 +42,6 @@
/* Macros: */
#define ANDROID_DATA_IN_PIPE 1
#define ANDROID_DATA_OUT_PIPE 2
-
- #define ANDROID_INTERFACE_CLASS 0xFF
- #define ANDROID_INTERFACE_SUBCLASS 0xFF
- #define ANDROID_INTERFACE_PROTOCOL 0x00
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessConfigurationDescriptor() function. */
diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/DeviceDescriptor.h b/Demos/Host/LowLevel/AndroidAccessoryHost/DeviceDescriptor.h
index 9259c8add..58726af20 100644
--- a/Demos/Host/LowLevel/AndroidAccessoryHost/DeviceDescriptor.h
+++ b/Demos/Host/LowLevel/AndroidAccessoryHost/DeviceDescriptor.h
@@ -41,11 +41,6 @@
#include "AndroidAccessoryHost.h"
- /* Macros: */
- #define ANDROID_VENDOR_ID 0x18D1
- #define ANDROID_ACCESSORY_PRODUCT_ID 0x2D00
- #define ANDROID_ACCESSORY_ADB_PRODUCT_ID 0x2D01
-
/* Enums: */
/** Enum for the possible return codes of the \ref ProcessDeviceDescriptor() function. */
enum AndroidHost_GetDeviceDescriptorDataCodes_t
diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.c b/Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.c
index 3931716ab..42c3a62fa 100644
--- a/Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.c
+++ b/Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.c
@@ -41,7 +41,7 @@ uint8_t Android_GetAccessoryProtocol(uint16_t* const Protocol)
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_DEVICETOHOST | REQTYPE_VENDOR | REQREC_DEVICE),
- .bRequest = ANDROID_Req_GetAccessoryProtocol,
+ .bRequest = AOA_REQ_GetAccessoryProtocol,
.wValue = 0,
.wIndex = 0,
.wLength = sizeof(uint16_t),
@@ -57,7 +57,7 @@ uint8_t Android_SendString(const uint8_t StringIndex,
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_VENDOR | REQREC_DEVICE),
- .bRequest = ANDROID_Req_SendString,
+ .bRequest = AOA_REQ_SendString,
.wValue = 0,
.wIndex = StringIndex,
.wLength = (strlen(String) + 1),
@@ -72,7 +72,7 @@ uint8_t Android_StartAccessoryMode(void)
USB_ControlRequest = (USB_Request_Header_t)
{
.bmRequestType = (REQDIR_HOSTTODEVICE | REQTYPE_VENDOR | REQREC_DEVICE),
- .bRequest = ANDROID_Req_StartAccessoryMode,
+ .bRequest = AOA_REQ_StartAccessoryMode,
.wValue = 0,
.wIndex = 0,
.wLength = 0,
diff --git a/Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.h b/Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.h
index 594370526..0fab7635f 100644
--- a/Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.h
+++ b/Demos/Host/LowLevel/AndroidAccessoryHost/Lib/AndroidAccessoryCommands.h
@@ -41,29 +41,6 @@
#include <stdbool.h>
#include <LUFA/Drivers/USB/USB.h>
-
- /* Enums: */
- enum Android_Requests_t
- {
- ANDROID_Req_GetAccessoryProtocol = 51,
- ANDROID_Req_SendString = 52,
- ANDROID_Req_StartAccessoryMode = 53,
- };
-
- enum Android_Strings_t
- {
- ANDROID_STRING_Manufacturer = 0,
- ANDROID_STRING_Model = 1,
- ANDROID_STRING_Description = 2,
- ANDROID_STRING_Version = 3,
- ANDROID_STRING_URI = 4,
- ANDROID_STRING_Serial = 5,
- };
-
- enum Android_Protocols_t
- {
- ANDROID_PROTOCOL_Accessory = 0x0001,
- };
/* Function Prototypes: */
uint8_t Android_GetAccessoryProtocol(uint16_t* const Protocol);