USB Host Shield 2.0
settings.h
Go to the documentation of this file.
1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2 
3 This software may be distributed and modified under the terms of the GNU
4 General Public License version 2 (GPL2) as published by the Free Software
5 Foundation and appearing in the file GPL2.TXT included in the packaging of
6 this file. Please note that GPL2 Section 2[b] requires that all works based
7 on this software must also be made publicly available under the terms of
8 the GPL2 ("Copyleft").
9 
10 Contact information
11 -------------------
12 
13 Circuits At Home, LTD
14 Web : http://www.circuitsathome.com
15 e-mail : support@circuitsathome.com
16  */
17 
18 #ifndef USB_HOST_SHIELD_SETTINGS_H
19 #define USB_HOST_SHIELD_SETTINGS_H
20 #include "macros.h"
21 
23 // DEBUGGING
25 
26 /* Set this to 1 to activate serial debugging */
27 #define ENABLE_UHS_DEBUGGING 0
28 
29 /* This can be used to select which serial port to use for debugging if
30  * multiple serial ports are available.
31  * For example Serial3.
32  */
33 #ifndef USB_HOST_SERIAL
34 #define USB_HOST_SERIAL Serial
35 #endif
36 
38 // Manual board activation
40 
41 /* Set this to 1 if you are using an Arduino Mega ADK board with MAX3421e built-in */
42 #define USE_UHS_MEGA_ADK 0 // If you are using Arduino 1.5.5 or newer there is no need to do this manually
43 
44 /* Set this to 1 if you are using a Black Widdow */
45 #define USE_UHS_BLACK_WIDDOW 0
46 
47 /* Set this to a one to use the xmem2 lock. This is needed for multitasking and threading */
48 #define USE_XMEM_SPI_LOCK 0
49 
51 // Wii IR camera
53 
54 /* Set this to 1 to activate code for the Wii IR camera */
55 #define ENABLE_WII_IR_CAMERA 0
56 
58 // MASS STORAGE
60 // <<<<<<<<<<<<<<<< IMPORTANT >>>>>>>>>>>>>>>
61 // Set this to 1 to support single LUN devices, and save RAM. -- I.E. thumb drives.
62 // Each LUN needs ~13 bytes to be able to track the state of each unit.
63 #ifndef MASS_MAX_SUPPORTED_LUN
64 #define MASS_MAX_SUPPORTED_LUN 8
65 #endif
66 
68 // Set to 1 to use the faster spi4teensy3 driver.
70 #ifndef USE_SPI4TEENSY3
71 #define USE_SPI4TEENSY3 1
72 #endif
73 
74 // disabled on the Teensy LC as it is incompatible for now
75 #if defined(__MKL26Z64__)
76 #undef USE_SPI4TEENSY3
77 #define USE_SPI4TEENSY3 0
78 #endif
79 
81 // AUTOMATIC Settings
83 
84 // No user serviceable parts below this line.
85 // DO NOT change anything below here unless you are a developer!
86 
87 #include "version_helper.h"
88 
89 #if defined(__GNUC__) && defined(__AVR__)
90 #ifndef GCC_VERSION
91 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
92 #endif
93 #if GCC_VERSION < 40602 // Test for GCC < 4.6.2
94 #ifdef PROGMEM
95 #undef PROGMEM
96 #define PROGMEM __attribute__((section(".progmem.data"))) // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734#c4
97 #ifdef PSTR
98 #undef PSTR
99 #define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) // Copied from pgmspace.h in avr-libc source
100 #endif
101 #endif
102 #endif
103 #endif
104 
105 #if !defined(DEBUG_USB_HOST) && ENABLE_UHS_DEBUGGING
106 #define DEBUG_USB_HOST
107 #endif
108 
109 #if !defined(WIICAMERA) && ENABLE_WII_IR_CAMERA
110 #define WIICAMERA
111 #endif
112 
113 // To use some other locking (e.g. freertos),
114 // define XMEM_ACQUIRE_SPI and XMEM_RELEASE_SPI to point to your lock and unlock.
115 // NOTE: NO argument is passed. You have to do this within your routine for
116 // whatever you are using to lock and unlock.
117 #if !defined(XMEM_ACQUIRE_SPI)
118 #if USE_XMEM_SPI_LOCK || defined(USE_MULTIPLE_APP_API)
119 #include <xmem.h>
120 #else
121 #define XMEM_ACQUIRE_SPI() (void(0))
122 #define XMEM_RELEASE_SPI() (void(0))
123 #endif
124 #endif
125 
126 #if !defined(EXT_RAM) && defined(EXT_RAM_STACK) || defined(EXT_RAM_HEAP)
127 #include <xmem.h>
128 #else
129 #define EXT_RAM 0
130 #endif
131 
132 #if defined(CORE_TEENSY) && (defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MKL26Z64__))
133 #define USING_SPI4TEENSY3 USE_SPI4TEENSY3
134 #else
135 #define USING_SPI4TEENSY3 0
136 #endif
137 
138 #if ((defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)) || defined(__ARDUINO_X86__) || ARDUINO >= 10600) && !USING_SPI4TEENSY3
139 #include <SPI.h> // Use the Arduino SPI library for the Arduino Due, Intel Galileo 1 & 2, Intel Edison or if the SPI library with transaction is available
140 #endif
141 #ifdef RBL_NRF51822
142 #include <nrf_gpio.h>
143 #include <SPI_Master.h>
144 #define SPI SPI_Master
145 #endif
146 #if defined(__PIC32MX__) || defined(__PIC32MZ__)
147 #include <../../../../hardware/pic32/libraries/SPI/SPI.h> // Hack to use the SPI library
148 #endif
149 
150 #ifdef STM32F4
151 #include "stm32f4xx_hal.h"
152 extern SPI_HandleTypeDef SPI_Handle; // Needed to be declared in your main.cpp
153 #endif
154 
155 // Fix defines on Arduino Due
156 #ifdef ARDUINO_SAM_DUE
157 #ifdef tokSETUP
158 #undef tokSETUP
159 #endif
160 #ifdef tokIN
161 #undef tokIN
162 #endif
163 #ifdef tokOUT
164 #undef tokOUT
165 #endif
166 #ifdef tokINHS
167 #undef tokINHS
168 #endif
169 #ifdef tokOUTHS
170 #undef tokOUTHS
171 #endif
172 #endif
173 
174 #endif /* SETTINGS_H */