3 Copyright (C) Dean Camera, 2010.
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
10 Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
12 Permission to use, copy, modify, distribute, and sell this
13 software and its documentation for any purpose is hereby granted
14 without fee, provided that the above copyright notice appear in
15 all copies and that both that the copyright notice and this
16 permission notice and warranty disclaimer appear in supporting
17 documentation, and that the name of the author not be used in
18 advertising or publicity pertaining to distribution of the
19 software without specific, written prior permission.
21 The author disclaim all warranties with regard to this
22 software, including all implied warranties of merchantability
23 and fitness. In no event shall the author be liable for any
24 special, indirect or consequential damages or any damages
25 whatsoever resulting from loss of use, data or profits, whether
26 in an action of contract, negligence or other tortious action,
27 arising out of or in connection with the use or performance of
31 /** \ingroup Group_USB
32 * @defgroup Group_USBMode USB Mode Tokens
34 * After the inclusion of the master USB driver header, one or more of the following
35 * tokens may be defined, to allow the user code to conditionally enable or disable
36 * code based on the USB controller family and allowable USB modes. These tokens may
37 * be tested against to eliminate code relating to a USB mode which is not enabled for
38 * the given compilation.
46 /* Public Interface - May be used in end-application: */
47 #if defined(__DOXYGEN__)
48 /** Indicates that the target AVR microcontroller belongs to the Series 2 USB controller
49 * (i.e. AT90USBXXX2 or ATMEGAXXU2) when defined.
51 #define USB_SERIES_2_AVR
53 /** Indicates that the target AVR microcontroller belongs to the Series 4 USB controller
54 * (i.e. ATMEGAXXU4) when defined.
56 #define USB_SERIES_4_AVR
58 /** Indicates that the target AVR microcontroller belongs to the Series 6 USB controller
59 * (i.e. AT90USBXXX6) when defined.
61 #define USB_SERIES_6_AVR
63 /** Indicates that the target AVR microcontroller belongs to the Series 7 USB controller
64 * (i.e. AT90USBXXX7) when defined.
66 #define USB_SERIES_7_AVR
68 /** Indicates that the target AVR microcontroller and compilation settings allow for the
69 * target to be configured in USB Device mode when defined.
71 #define USB_CAN_BE_DEVICE
73 /** Indicates that the target AVR microcontroller and compilation settings allow for the
74 * target to be configured in USB Host mode when defined.
76 #define USB_CAN_BE_HOST
78 /** Indicates that the target AVR microcontroller and compilation settings allow for the
79 * target to be configured in either USB Device or Host mode when defined.
81 #define USB_CAN_BE_BOTH
84 #if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \
85 defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__))
86 #define USB_SERIES_2_AVR
87 #elif (defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__))
88 #define USB_SERIES_4_AVR
89 #elif (defined(__AVR_ATmega32U6__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
90 #define USB_SERIES_6_AVR
91 #elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__))
92 #define USB_SERIES_7_AVR
95 #if !defined(USB_SERIES_7_AVR)
96 #if defined(USB_HOST_ONLY)
97 #error USB_HOST_ONLY is not available for the currently selected USB AVR model.
100 #if !defined(USB_DEVICE_ONLY)
101 #define USB_DEVICE_ONLY
105 #if (!defined(USB_DEVICE_ONLY) && !defined(USB_HOST_ONLY))
106 #define USB_CAN_BE_BOTH
107 #define USB_CAN_BE_HOST
108 #define USB_CAN_BE_DEVICE
109 #elif defined(USB_HOST_ONLY)
110 #define USB_CAN_BE_HOST
111 #elif defined(USB_DEVICE_ONLY)
112 #define USB_CAN_BE_DEVICE
115 #if (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY))
116 #error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive.