Commit 8b5aa616 authored by Dean Camera's avatar Dean Camera

Add new Android Open Accessory class driver to the library core and add a new...

Add new Android Open Accessory class driver to the library core and add a new Android Open Accessory Host ClassDriver demo.
parent 075538ab
<AVRStudio><MANAGEMENT><ProjectName>AndroidAccessoryHost</ProjectName><Created>09-Jun-2011 14:10:10</Created><LastEdit>09-Jun-2011 14:10:10</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>09-Jun-2011 14:10:10</Created><Version>4</Version><Build>4, 18, 0, 685</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile></ObjectFile><EntryFile></EntryFile><SaveFolder>C:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Demos\Host\ClassDriver\AndroidAccessoryHost\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>AVR ONE!</CURRENT_TARGET><CURRENT_PART></CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>AndroidAccessoryHost.c</SOURCEFILE><HEADERFILE>AndroidAccessoryHost.h</HEADERFILE><OTHERFILE>makefile</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>YES</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE>makefile</EXTERNALMAKEFILE><PART>atmega128</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>AndroidAccessoryHost.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\WinAVR-20100110\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\WinAVR-20100110\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/><sort sorted="0" column="0" ordername="0" orderaddress="0" ordergroup="0"/></IOView><Files></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
/*
LUFA Library
Copyright (C) Dean Camera, 2011.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* Main source file for the AndroidAccessoryHost demo. This file contains the main tasks of
* the demo and is responsible for the initial application hardware configuration.
*/
#include "AndroidAccessoryHost.h"
/** LUFA Android Open Accessory Class driver interface configuration and state information. This
* structure is passed to all Android Open Accessory Class driver functions, so that multiple
* instances of the same class within a device can be differentiated from one another.
*/
USB_ClassInfo_AOA_Host_t AndroidDevice_AOA_Interface =
{
.Config =
{
.DataINPipeNumber = 1,
.DataINPipeDoubleBank = false,
.DataOUTPipeNumber = 2,
.DataOUTPipeDoubleBank = false,
.PropertyStrings =
{
.Manufacturer = "Dean Camera",
.Model = "LUFA Android Demo",
.Description = "LUFA Android Demo",
.Version = "1.0",
.URI = "http://www.lufa-lib.org",
.Serial = "0000000012345678",
},
},
};
/** Main program entry point. This routine configures the hardware required by the application, then
* enters a loop to run the application tasks in sequence.
*/
int main(void)
{
SetupHardware();
puts_P(PSTR(ESC_FG_CYAN "Android Accessory Host Demo running.\r\n" ESC_FG_WHITE));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
sei();
for (;;)
{
AOAHost_Task();
AOA_Host_USBTask(&AndroidDevice_AOA_Interface);
USB_USBTask();
}
}
/** Configures the board hardware and chip peripherals for the demo's functionality. */
void SetupHardware(void)
{
/* Disable watchdog if enabled by bootloader/fuses */
MCUSR &= ~(1 << WDRF);
wdt_disable();
/* Disable clock division */
clock_prescale_set(clock_div_1);
/* Hardware Initialization */
Serial_Init(9600, false);
LEDs_Init();
USB_Init();
/* Create a stdio stream for the serial port for stdin and stdout */
Serial_CreateStream(NULL);
}
/** Task to manage an enumerated USB Android Accessory device once connected, to print received data
* from the device to the serial port.
*/
void AOAHost_Task(void)
{
if (USB_HostState != HOST_STATE_Configured)
return;
if (AOA_Host_BytesReceived(&AndroidDevice_AOA_Interface))
{
/* Echo received bytes from the attached device through the USART */
int16_t ReceivedByte = AOA_Host_ReceiveByte(&AndroidDevice_AOA_Interface);
if (!(ReceivedByte < 0))
putchar(ReceivedByte);
}
}
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
* starts the library USB task to begin the enumeration and USB management process.
*/
void EVENT_USB_Host_DeviceAttached(void)
{
puts_P(PSTR("Device Attached.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
}
/** Event handler for the USB_DeviceUnattached event. This indicates that a device has been removed from the host, and
* stops the library USB task management process.
*/
void EVENT_USB_Host_DeviceUnattached(void)
{
puts_P(PSTR("\r\nDevice Unattached.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
}
/** Event handler for the USB_DeviceEnumerationComplete event. This indicates that a device has been successfully
* enumerated by the host and is now ready to be used by the application.
*/
void EVENT_USB_Host_DeviceEnumerationComplete(void)
{
LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
USB_Descriptor_Device_t DeviceDescriptor;
if (USB_Host_GetDeviceDescriptor(&DeviceDescriptor) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Retrieving Device Descriptor.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
return;
}
bool NeedModeSwitch;
if (!(AOA_Host_ValidateAccessoryDevice(&AndroidDevice_AOA_Interface, &DeviceDescriptor, &NeedModeSwitch)))
{
puts_P(PSTR("Not an Android device.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
return;
}
if (NeedModeSwitch)
{
puts_P(PSTR("Not in Accessory mode, switching...\r\n"));
AOA_Host_StartAccessoryMode(&AndroidDevice_AOA_Interface);
return;
}
uint16_t ConfigDescriptorSize;
uint8_t ConfigDescriptorData[512];
if (USB_Host_GetDeviceConfigDescriptor(1, &ConfigDescriptorSize, ConfigDescriptorData,
sizeof(ConfigDescriptorData)) != HOST_GETCONFIG_Successful)
{
puts_P(PSTR("Error Retrieving Configuration Descriptor.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
return;
}
if (AOA_Host_ConfigurePipes(&AndroidDevice_AOA_Interface,
ConfigDescriptorSize, ConfigDescriptorData) != AOA_ENUMERROR_NoError)
{
puts_P(PSTR("Attached Device Not a Valid Android Accessory Class Device.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
return;
}
if (USB_Host_SetDeviceConfiguration(1) != HOST_SENDCONTROL_Successful)
{
puts_P(PSTR("Error Setting Device Configuration.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
return;
}
puts_P(PSTR("Android Device Enumerated.\r\n"));
LEDs_SetAllLEDs(LEDMASK_USB_READY);
}
/** Event handler for the USB_HostError event. This indicates that a hardware error occurred while in host mode. */
void EVENT_USB_Host_HostError(const uint8_t ErrorCode)
{
USB_Disable();
printf_P(PSTR(ESC_FG_RED "Host Mode Error\r\n"
" -- Error Code %d\r\n" ESC_FG_WHITE), ErrorCode);
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
for(;;);
}
/** Event handler for the USB_DeviceEnumerationFailed event. This indicates that a problem occurred while
* enumerating an attached USB device.
*/
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode)
{
printf_P(PSTR(ESC_FG_RED "Dev Enum Error\r\n"
" -- Error Code %d\r\n"
" -- Sub Error Code %d\r\n"
" -- In State %d\r\n" ESC_FG_WHITE), ErrorCode, SubErrorCode, USB_HostState);
LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
}
/*
LUFA Library
Copyright (C) Dean Camera, 2011.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
*
* Header file for AndroidAccessoryHost.c.
*/
#ifndef _ANDROIDACCESSORY_HOST_H_
#define _ANDROIDACCESSORY_HOST_H_
/* Includes: */
#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/pgmspace.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <stdio.h>
#include <LUFA/Version.h>
#include <LUFA/Drivers/Misc/TerminalCodes.h>
#include <LUFA/Drivers/Peripheral/Serial.h>
#include <LUFA/Drivers/Board/LEDs.h>
#include <LUFA/Drivers/USB/USB.h>
/* Macros: */
/** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
#define LEDMASK_USB_NOTREADY LEDS_LED1
/** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
#define LEDMASK_USB_ENUMERATING (LEDS_LED2 | LEDS_LED3)
/** LED mask for the library LED driver, to indicate that the USB interface is ready. */
#define LEDMASK_USB_READY (LEDS_LED2 | LEDS_LED4)
/** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
#define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED3)
/* Function Prototypes: */
void SetupHardware(void);
void AOAHost_Task(void);
void EVENT_USB_Host_HostError(const uint8_t ErrorCode);
void EVENT_USB_Host_DeviceAttached(void);
void EVENT_USB_Host_DeviceUnattached(void);
void EVENT_USB_Host_DeviceEnumerationFailed(const uint8_t ErrorCode,
const uint8_t SubErrorCode);
void EVENT_USB_Host_DeviceEnumerationComplete(void);
#endif
/** \file
*
* This file contains special DoxyGen information for the generation of the main page and other special
* documentation pages. It is not a project source file.
*/
/** \mainpage Android Accessory Host Demo
*
* \section Sec_Compat Demo Compatibility:
*
* The following list indicates what microcontrollers are compatible with this demo.
*
* - Series 7 USB AVRs (AT90USBxxx7)
*
* \section Sec_Info USB Information:
*
* The following table gives a rundown of the USB utilization of this demo.
*
* <table>
* <tr>
* <td><b>USB Mode:</b></td>
* <td>Host</td>
* </tr>
* <tr>
* <td><b>USB Class:</b></td>
* <td>Android Accessory Host Class</td>
* </tr>
* <tr>
* <td><b>USB Subclass:</b></td>
* <td>N/A</td>
* </tr>
* <tr>
* <td><b>Relevant Standards:</b></td>
* <td>Android Accessory Host Specification</td>
* </tr>
* <tr>
* <td><b>Usable Speeds:</b></td>
* <td>Full Speed Mode</td>
* </tr>
* </table>
*
* \section Sec_Description Project Description:
*
* Android Accessory Host demonstration application. This gives a simple reference
* application for implementing an Android Accessory Host device capable of hosting
* Android powered mobile devices to send and receive data.
*
* Data sent from the Android device will be sent out the AVR's serial port.
*
* \section Sec_Options Project Options
*
* The following defines can be found in this demo, which can control the demo behaviour when defined, or changed in value.
*
* <table>
* <tr>
* <td>
* None
* </td>
* </tr>
* </table>
*/
This diff is collapsed.
This diff is collapsed.
......@@ -14,6 +14,9 @@
# code.
all:
$(MAKE) -C AndroidAccessoryHost clean
$(MAKE) -C AndroidAccessoryHost all
$(MAKE) -C AudioInputHost clean
$(MAKE) -C AudioInputHost all
......@@ -54,6 +57,7 @@ all:
$(MAKE) -C VirtualSerialHost all
%:
$(MAKE) -C AndroidAccessoryHost $@
$(MAKE) -C AudioInputHost $@
$(MAKE) -C AudioOutputHost $@
$(MAKE) -C JoystickHostWithParser $@
......
<AVRStudio><MANAGEMENT><ProjectName>AndroidAccessoryHost</ProjectName><Created>06-Jun-2011 19:58:20</Created><LastEdit>06-Jun-2011 19:58:20</LastEdit><ICON>241</ICON><ProjectType>0</ProjectType><Created>06-Jun-2011 19:58:20</Created><Version>4</Version><Build>4, 18, 0, 685</Build><ProjectTypeName>AVR GCC</ProjectTypeName></MANAGEMENT><CODE_CREATION><ObjectFile></ObjectFile><EntryFile></EntryFile><SaveFolder>C:\Users\Dean\Documents\Electronics\Projects\WORK\LUFAWORK\Demos\Host\LowLevel\AndroidAccessoryHost\</SaveFolder></CODE_CREATION><DEBUG_TARGET><CURRENT_TARGET>AVR ONE!</CURRENT_TARGET><CURRENT_PART></CURRENT_PART><BREAKPOINTS></BREAKPOINTS><IO_EXPAND><HIDE>false</HIDE></IO_EXPAND><REGISTERNAMES><Register>R00</Register><Register>R01</Register><Register>R02</Register><Register>R03</Register><Register>R04</Register><Register>R05</Register><Register>R06</Register><Register>R07</Register><Register>R08</Register><Register>R09</Register><Register>R10</Register><Register>R11</Register><Register>R12</Register><Register>R13</Register><Register>R14</Register><Register>R15</Register><Register>R16</Register><Register>R17</Register><Register>R18</Register><Register>R19</Register><Register>R20</Register><Register>R21</Register><Register>R22</Register><Register>R23</Register><Register>R24</Register><Register>R25</Register><Register>R26</Register><Register>R27</Register><Register>R28</Register><Register>R29</Register><Register>R30</Register><Register>R31</Register></REGISTERNAMES><COM>Auto</COM><COMType>0</COMType><WATCHNUM>0</WATCHNUM><WATCHNAMES><Pane0></Pane0><Pane1></Pane1><Pane2></Pane2><Pane3></Pane3></WATCHNAMES><BreakOnTrcaeFull>0</BreakOnTrcaeFull></DEBUG_TARGET><Debugger><Triggers></Triggers></Debugger><AVRGCCPLUGIN><FILES><SOURCEFILE>ConfigDescriptor.c</SOURCEFILE><SOURCEFILE>AndroidAccessoryHost.c</SOURCEFILE><SOURCEFILE>Lib/AndroidAccessoryCommands.c</SOURCEFILE><HEADERFILE>Lib/AndroidAccessoryCommands.h</HEADERFILE><HEADERFILE>ConfigDescriptor.h</HEADERFILE><HEADERFILE>AndroidAccessoryHost.h</HEADERFILE><OTHERFILE>makefile</OTHERFILE></FILES><CONFIGS><CONFIG><NAME>default</NAME><USESEXTERNALMAKEFILE>YES</USESEXTERNALMAKEFILE><EXTERNALMAKEFILE>makefile</EXTERNALMAKEFILE><PART>atmega128</PART><HEX>1</HEX><LIST>1</LIST><MAP>1</MAP><OUTPUTFILENAME>AndroidAccessoryHost.elf</OUTPUTFILENAME><OUTPUTDIR>default\</OUTPUTDIR><ISDIRTY>1</ISDIRTY><OPTIONS/><INCDIRS/><LIBDIRS/><LIBS/><LINKOBJECTS/><OPTIONSFORALL>-Wall -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums</OPTIONSFORALL><LINKEROPTIONS></LINKEROPTIONS><SEGMENTS/></CONFIG></CONFIGS><LASTCONFIG>default</LASTCONFIG><USES_WINAVR>1</USES_WINAVR><GCC_LOC>C:\WinAVR-20100110\bin\avr-gcc.exe</GCC_LOC><MAKE_LOC>C:\WinAVR-20100110\utils\bin\make.exe</MAKE_LOC></AVRGCCPLUGIN><IOView><usergroups/><sort sorted="0" column="0" ordername="0" orderaddress="0" ordergroup="0"/></IOView><Files></Files><Events><Bookmarks></Bookmarks></Events><Trace><Filters></Filters></Trace></AVRStudio>
......@@ -57,6 +57,7 @@ all:
$(MAKE) -C VirtualSerialHost all
%:
$(MAKE) -C AndroidAccessoryHost $@
$(MAKE) -C AudioInputHost $@
$(MAKE) -C AudioOutputHost $@
$(MAKE) -C GenericHIDHost $@
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -12,6 +12,7 @@
* - Added support for the XMEGA A3BU Xplained board
* - Added support for the new B series XMEGA devices
* - Added support for version 2 of the Teensy boards (thanks to Christoph Redecker)
* - Added new Android Accessory Host class driver
* - Library Applications:
* - Added User Application APIs to the CDC and DFU class bootloaders
* - Added INVERTED_ISP_MISO compile time option to the AVRISP-MKII clone project (thanks to Chuck Rohs)
......
......@@ -40,6 +40,7 @@
* -# Add class driver support for Test and Measurement class
* -# Add class driver support for EEM class
* -# Add class driver support for ECM class
* -# Add class driver support for the Android Accessory Host class
* -# Port all demos to multiple architectures
* - Ports
* -# Finish USB XMEGA port
......
......@@ -66,6 +66,7 @@
* Measurement class
* - <b>Host</b>
* - <b>ClassDriver</b>
* - <b>AndroidAccessoryHost</b> - Android Accessory host demo, using the library USB Android Open Accessory Class driver framework
* - <b>AudioInputHost</b> - Audio Input host demo, using the library USB Audio Class driver framework
* - <b>AudioOutputHost</b> - Audio Output host demo, using the library USB Audio Class driver framework
* - <b>JoystickHostWithParser</b> - Joystick host demo with HID Descriptor parser, using the library USB HID Class driver framework
......@@ -79,7 +80,7 @@
* - <b>StillImageHost</b> - Still Image Camera host demo, using the library USB Still Image Class driver framework
* - <b>VirtualSerialHost</b> - Virtual Serial Port host demo, using the library USB CDC Class driver framework
* - <b>LowLevel</b>
* - <b>AndroidAccessoryHost</b> - Android Accessory host demo, using the low level LUFA APIs to implement the Android Accessory Host class
* - <b>AndroidAccessoryHost</b> - Android Accessory host demo, using the low level LUFA APIs to implement the Android Open Accessory class
* - <b>AudioInputHost</b> - Audio Input host demo, using the low level LUFA APIs to implement the USB Audio class
* - <b>AudioOutputHost</b> - Audio Output host demo, using the low level LUFA APIs to implement the USB Audio class
* - <b>GenericHIDHost</b> - Generic HID host demo, using the low level LUFA APIs to implement the USB HID class
......
/*
LUFA Library
Copyright (C) Dean Camera, 2011.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief Master include file for the library USB Android Open Accessory Class driver.
*
* Master include file for the library USB Android Open Accessory Class driver, for both host and device modes, where available.
*
* This file should be included in all user projects making use of this optional class driver, instead of
* including any headers in the USB/ClassDriver/Device, USB/ClassDriver/Host or USB/ClassDriver/Common subdirectories.
*/
/** \ingroup Group_USBClassDrivers
* \defgroup Group_USBClassAOA Android Open Accessory Class Driver
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Host/AndroidAccessoryClassHost.c <i>(Makefile source module name: LUFA_SRC_USBCLASS)</i>
*
* \section Sec_ModDescription Module Description
* Android Open Accessory Class Driver module. This module contains an internal implementation of the USB Android Open Accessory
* Class, for Host USB mode. User applications can use this class driver instead of implementing the Android Open Accessory Class
* manually via the low-level LUFA APIs.
*
* This module is designed to simplify the user code by exposing only the required interface needed to interface with
* Host using the USB Android Open Accessory Class.
*
* @{
*/
#ifndef _AOA_CLASS_H_
#define _AOA_CLASS_H_
/* Macros: */
#define __INCLUDE_FROM_USB_DRIVER
#define __INCLUDE_FROM_AOA_DRIVER
/* Includes: */
#include "../Core/USBMode.h"
#if defined(USB_CAN_BE_HOST)
#include "Host/AndroidAccessoryClassHost.h"
#endif
#endif
/** @} */
......@@ -42,8 +42,8 @@
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/Audio.c <i>(Makefile source module name: LUFA_SRC_USBCLASS)</i>
* - LUFA/Drivers/USB/Class/Host/Audio.c <i>(Makefile source module name: LUFA_SRC_USBCLASS)</i>
* - LUFA/Drivers/USB/Class/Device/AudioClassDevice.c <i>(Makefile source module name: LUFA_SRC_USBCLASS)</i>
* - LUFA/Drivers/USB/Class/Host/AudioClassHost.c <i>(Makefile source module name: LUFA_SRC_USBCLASS)</i>
*
* \section Sec_ModDescription Module Description
* Audio 1.0 Class Driver module. This module contains an internal implementation of the USB Audio 1.0 Class, for both
......
......@@ -42,8 +42,8 @@
*
* \section Sec_Dependencies Module Source Dependencies
* The following files must be built with any user project that uses this module:
* - LUFA/Drivers/USB/Class/Device/CDC.c <i>(Makefile source module name: LUFA_SRC_USBCLASS)</i>
* - LUFA/Drivers/USB/Class/Host/CDC.c <i>(Makefile source module name: LUFA_SRC_USBCLASS)</i>
* - LUFA/Drivers/USB/Class/Device/CDCClassDevice.c <i>(Makefile source module name: LUFA_SRC_USBCLASS)</i>
* - LUFA/Drivers/USB/Class/Host/CDCClassHost.c <i>(Makefile source module name: LUFA_SRC_USBCLASS)</i>
*
* \section Sec_ModDescription Module Description
* CDC Class Driver module. This module contains an internal implementation of the USB CDC-ACM class Virtual Serial
......
/*
LUFA Library
Copyright (C) Dean Camera, 2011.
dean [at] fourwalledcubicle [dot] com
www.lufa-lib.org
*/
/*
Copyright 2011 Dean Camera (dean [at] fourwalledcubicle [dot] com)
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
without fee, provided that the above copyright notice appear in
all copies and that both that the copyright notice and this
permission notice and warranty disclaimer appear in supporting
documentation, and that the name of the author not be used in
advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
The author disclaim all warranties with regard to this
software, including all implied warranties of merchantability
and fitness. In no event shall the author be liable for any
special, indirect or consequential damages or any damages
whatsoever resulting from loss of use, data or profits, whether
in an action of contract, negligence or other tortious action,
arising out of or in connection with the use or performance of
this software.
*/
/** \file
* \brief Common definitions and declarations for the library USB Android Open Accessory Class driver.
*
* Common definitions and declarations for the library USB Android Open Accessory Class driver.
*
* \note This file should not be included directly. It is automatically included as needed by the USB module driver
* dispatch header located in LUFA/Drivers/USB.h.
*/
/** \ingroup Group_USBClassAOA
* \defgroup Group_USBClassAOACommon Common Class Definitions
*
* \section Sec_ModDescription Module Description
* Constants, Types and Enum definitions that are common to both Device and Host modes for the USB
* Android Open Accessory Class.
*
* @{
*/
#ifndef _AOA_CLASS_COMMON_H_
#define _AOA_CLASS_COMMON_H_
/* Includes: */
#include "../../Core/StdDescriptors.h"
/* Enable C linkage for C++ Compilers: */
#if defined(__cplusplus)
extern "C" {
#endif
/* Preprocessor Checks: */
#if !defined(__INCLUDE_FROM_AOA_DRIVER)
#error Do not include this file directly. Include LUFA/Drivers/USB.h instead.
#endif
/* Macros: */
#define ANDROID_VENDOR_ID 0x18D1
#define ANDROID_ACCESSORY_PRODUCT_ID 0x2D00
#define ANDROID_ACCESSORY_ADB_PRODUCT_ID 0x2D01
/* Enums: */
/** Enum for possible Class, Subclass and Protocol values of device and interface descriptors relating to the
* Android Open Accessory class.
*/
enum AOA_Descriptor_ClassSubclassProtocol_t
{
AOA_CSCP_AOADataClass = 0xFF, /**< Descriptor Class value indicating that the device or interface
* belongs to the AOA data class.
*/
AOA_CSCP_AOADataSubclass = 0x00, /**< Descriptor Subclass value indicating that the device or interface
* belongs to AOA data subclass.
*/
AOA_CSCP_AOADataProtocol = 0x00, /**< Descriptor Protocol value indicating that the device or interface
* belongs to the AOA data class protocol.
*/
};
/** Enum for the Android Open Accessory class specific control requests that can be issued by the USB bus host. */
enum AOA_ClassRequests_t
{
AOA_REQ_GetAccessoryProtocol = 0x33, /**< Android Open Accessory control request to retrieve the device's supported Accessory Protocol version. */
AOA_REQ_SendString = 0x34, /**< Android Open Accessory control request to set an accessory property string in the device. */
AOA_REQ_StartAccessoryMode = 0x35, /**< Android Open Accessory control request to switch the device into Accessory mode. */
};
/** Enum for the possible Android Open Accessory property string indexes. */
enum AOA_Strings_t
{
AOA_STRING_Manufacturer = 0, /**< Index of the Manufacturer property string. */
AOA_STRING_Model = 1, /**< Index of the Model Name property string. */
AOA_STRING_Description = 2, /**< Index of the Description property string. */
AOA_STRING_Version = 3, /**< Index of the Version Number property string. */
AOA_STRING_URI = 4, /**< Index of the URI Information property string. */
AOA_STRING_Serial = 5, /**< Index of the Serial Number property string. */
#if !defined(__DOXYGEN__)
AOA_STRING_TOTAL_STRINGS
#endif
};
/** Enum for the possible Android Open Accessory protocol versions. */
enum AOA_Protocols_t
{
AOA_PROTOCOL_Accessory = 0x0001, /**< Android Open Accessory version 1. */
};
/* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus)
}