Fixed compilation error in the AudioInput demos when MICROPHONE_BIASED_TO_HALF_RAIL...
[pub/USBasp.git] / LUFA / Drivers / USB / HighLevel / USBMode.h
1 /*
2 LUFA Library
3 Copyright (C) Dean Camera, 2010.
4
5 dean [at] fourwalledcubicle [dot] com
6 www.fourwalledcubicle.com
7 */
8
9 /*
10 Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com)
11
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.
20
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
28 this software.
29 */
30
31 /** \ingroup Group_USB
32 * @defgroup Group_USBMode USB Mode Tokens
33 *
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.
39 *
40 * @{
41 */
42
43 #ifndef __USBMODE_H__
44 #define __USBMODE_H__
45
46 /* Preprocessor Checks: */
47 #if !defined(__INCLUDE_FROM_USB_DRIVER)
48 #error Do not include this file directly. Include LUFA/Drivers/USB/USB.h instead.
49 #endif
50
51 /* Public Interface - May be used in end-application: */
52 #if defined(__DOXYGEN__)
53 /** Indicates that the target AVR microcontroller belongs to the Series 2 USB controller
54 * (i.e. AT90USBXXX2 or ATMEGAXXU2) when defined.
55 */
56 #define USB_SERIES_2_AVR
57
58 /** Indicates that the target AVR microcontroller belongs to the Series 4 USB controller
59 * (i.e. ATMEGAXXU4) when defined.
60 */
61 #define USB_SERIES_4_AVR
62
63 /** Indicates that the target AVR microcontroller belongs to the Series 6 USB controller
64 * (i.e. AT90USBXXX6) when defined.
65 */
66 #define USB_SERIES_6_AVR
67
68 /** Indicates that the target AVR microcontroller belongs to the Series 7 USB controller
69 * (i.e. AT90USBXXX7) when defined.
70 */
71 #define USB_SERIES_7_AVR
72
73 /** Indicates that the target AVR microcontroller and compilation settings allow for the
74 * target to be configured in USB Device mode when defined.
75 */
76 #define USB_CAN_BE_DEVICE
77
78 /** Indicates that the target AVR microcontroller and compilation settings allow for the
79 * target to be configured in USB Host mode when defined.
80 */
81 #define USB_CAN_BE_HOST
82
83 /** Indicates that the target AVR microcontroller and compilation settings allow for the
84 * target to be configured in either USB Device or Host mode when defined.
85 */
86 #define USB_CAN_BE_BOTH
87 #else
88 /* Macros: */
89 #if (defined(__AVR_AT90USB162__) || defined(__AVR_AT90USB82__) || \
90 defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__))
91 #define USB_SERIES_2_AVR
92 #elif (defined(__AVR_ATmega32U4__) || defined(__AVR_ATmega16U4__))
93 #define USB_SERIES_4_AVR
94 #elif (defined(__AVR_ATmega32U6__) || defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__))
95 #define USB_SERIES_6_AVR
96 #elif (defined(__AVR_AT90USB647__) || defined(__AVR_AT90USB1287__))
97 #define USB_SERIES_7_AVR
98 #endif
99
100 #if !defined(USB_SERIES_7_AVR)
101 #if defined(USB_HOST_ONLY)
102 #error USB_HOST_ONLY is not available for the currently selected USB AVR model.
103 #endif
104
105 #if !defined(USB_DEVICE_ONLY)
106 #define USB_DEVICE_ONLY
107 #endif
108 #endif
109
110 #if (!defined(USB_DEVICE_ONLY) && !defined(USB_HOST_ONLY))
111 #define USB_CAN_BE_BOTH
112 #define USB_CAN_BE_HOST
113 #define USB_CAN_BE_DEVICE
114 #elif defined(USB_HOST_ONLY)
115 #define USB_CAN_BE_HOST
116 #elif defined(USB_DEVICE_ONLY)
117 #define USB_CAN_BE_DEVICE
118 #endif
119
120 #if (defined(USB_HOST_ONLY) && defined(USB_DEVICE_ONLY))
121 #error USB_HOST_ONLY and USB_DEVICE_ONLY are mutually exclusive.
122 #endif
123 #endif
124
125 #endif
126
127 /** @} */