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 program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2 of the License, or
6 (at your option) any later version.
7 
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 
13 You should have received a copy of the GNU General Public License
14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 
17 Contact information
18 -------------------
19 
20 Circuits At Home, LTD
21 Web : http://www.circuitsathome.com
22 e-mail : support@circuitsathome.com
23  */
24 
25 #ifndef USB_HOST_SHIELD_SETTINGS_H
26 #define USB_HOST_SHIELD_SETTINGS_H
27 #include "macros.h"
28 
30 // SPI Configuration
32 #ifndef USB_SPI
33 #define USB_SPI SPI
34 //#define USB_SPI SPI1
35 #endif
36 
38 // DEBUGGING
40 
41 /* Set this to 1 to activate serial debugging */
42 #define ENABLE_UHS_DEBUGGING 0
43 
44 /* This can be used to select which serial port to use for debugging if
45  * multiple serial ports are available.
46  * For example Serial3.
47  */
48 #ifndef USB_HOST_SERIAL
49 #define USB_HOST_SERIAL Serial
50 #endif
51 
53 // Manual board activation
55 
56 /* Set this to 1 if you are using an Arduino Mega ADK board with MAX3421e built-in */
57 #define USE_UHS_MEGA_ADK 0 // If you are using Arduino 1.5.5 or newer there is no need to do this manually
58 
59 /* Set this to 1 if you are using a Black Widdow */
60 #define USE_UHS_BLACK_WIDDOW 0
61 
62 /* Set this to a one to use the xmem2 lock. This is needed for multitasking and threading */
63 #define USE_XMEM_SPI_LOCK 0
64 
66 // Wii IR camera
68 
69 /* Set this to 1 to activate code for the Wii IR camera */
70 #define ENABLE_WII_IR_CAMERA 0
71 
73 // MASS STORAGE
75 // <<<<<<<<<<<<<<<< IMPORTANT >>>>>>>>>>>>>>>
76 // Set this to 1 to support single LUN devices, and save RAM. -- I.E. thumb drives.
77 // Each LUN needs ~13 bytes to be able to track the state of each unit.
78 #ifndef MASS_MAX_SUPPORTED_LUN
79 #define MASS_MAX_SUPPORTED_LUN 8
80 #endif
81 
83 // Set to 1 to use the faster spi4teensy3 driver on Teensy 3.x
85 #ifndef USE_SPI4TEENSY3
86 #if defined(CORE_TEENSY) && (defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK64FX512__) || defined(__MK66FX1M0__))
87 #define USE_SPI4TEENSY3 1
88 #else
89 #define USE_SPI4TEENSY3 0
90 #endif
91 #endif
92 
94 // AUTOMATIC Settings
96 
97 // No user serviceable parts below this line.
98 // DO NOT change anything below here unless you are a developer!
99 
100 #include "version_helper.h"
101 
102 #if defined(__GNUC__) && defined(__AVR__)
103 #ifndef GCC_VERSION
104 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
105 #endif
106 #if GCC_VERSION < 40602 // Test for GCC < 4.6.2
107 #ifdef PROGMEM
108 #undef PROGMEM
109 #define PROGMEM __attribute__((section(".progmem.data"))) // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734#c4
110 #ifdef PSTR
111 #undef PSTR
112 #define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) // Copied from pgmspace.h in avr-libc source
113 #endif
114 #endif
115 #endif
116 #endif
117 
118 #if !defined(DEBUG_USB_HOST) && ENABLE_UHS_DEBUGGING
119 #define DEBUG_USB_HOST
120 #endif
121 
122 #if !defined(WIICAMERA) && ENABLE_WII_IR_CAMERA
123 #define WIICAMERA
124 #endif
125 
126 // To use some other locking (e.g. freertos),
127 // define XMEM_ACQUIRE_SPI and XMEM_RELEASE_SPI to point to your lock and unlock.
128 // NOTE: NO argument is passed. You have to do this within your routine for
129 // whatever you are using to lock and unlock.
130 #if !defined(XMEM_ACQUIRE_SPI)
131 #if USE_XMEM_SPI_LOCK || defined(USE_MULTIPLE_APP_API)
132 #include <xmem.h>
133 #else
134 #define XMEM_ACQUIRE_SPI() (void(0))
135 #define XMEM_RELEASE_SPI() (void(0))
136 #endif
137 #endif
138 
139 #if !defined(EXT_RAM) && defined(EXT_RAM_STACK) || defined(EXT_RAM_HEAP)
140 #include <xmem.h>
141 #else
142 #define EXT_RAM 0
143 #endif
144 
145 #if defined(CORE_TEENSY) && defined(KINETISK)
146 #define USING_SPI4TEENSY3 USE_SPI4TEENSY3
147 #else
148 #define USING_SPI4TEENSY3 0
149 #endif
150 
151 #if ((defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)) || defined(__ARDUINO_X86__) || ARDUINO >= 10600) && !USING_SPI4TEENSY3
152 #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
153 #endif
154 #ifdef RBL_NRF51822
155 #include <nrf_gpio.h>
156 #include <SPI_Master.h>
157 #define SPI SPI_Master
158 #define MFK_CASTUINT8T (uint8_t) // RBLs return type for sizeof needs casting to uint8_t
159 #endif
160 #ifdef NRF52_SERIES
161 #include <SPI.h>
162 #include <nrf_gpio.h>
163 #define MFK_CASTUINT8T (uint8_t) // NRF return type for sizeof needs casting to uint8_t
164 #endif
165 #if defined(__PIC32MX__) || defined(__PIC32MZ__)
166 #include <../../../../hardware/pic32/libraries/SPI/SPI.h> // Hack to use the SPI library
167 #endif
168 
169 #if defined(ESP8266) || defined(ESP32)
170 #define MFK_CASTUINT8T (uint8_t) // ESP return type for sizeof needs casting to uint8_t
171 #endif
172 
173 #ifdef STM32F4
174 #include "stm32f4xx_hal.h"
175 extern SPI_HandleTypeDef SPI_Handle; // Needed to be declared in your main.cpp
176 #endif
177 
178 // Fix defines on Arduino Due
179 #ifdef ARDUINO_SAM_DUE
180 #ifdef tokSETUP
181 #undef tokSETUP
182 #endif
183 #ifdef tokIN
184 #undef tokIN
185 #endif
186 #ifdef tokOUT
187 #undef tokOUT
188 #endif
189 #ifdef tokINHS
190 #undef tokINHS
191 #endif
192 #ifdef tokOUTHS
193 #undef tokOUTHS
194 #endif
195 #endif
196 
197 // Set defaults
198 #ifndef MFK_CASTUINT8T
199 #define MFK_CASTUINT8T
200 #endif
201 
202 // Workaround issue: https://github.com/esp8266/Arduino/issues/2078
203 #ifdef ESP8266
204 #undef PROGMEM
205 #define PROGMEM
206 #undef PSTR
207 #define PSTR(s) (s)
208 #undef pgm_read_byte
209 #define pgm_read_byte(addr) (*reinterpret_cast<const uint8_t*>(addr))
210 #undef pgm_read_word
211 #define pgm_read_word(addr) (*reinterpret_cast<const uint16_t*>(addr))
212 #endif
213 
214 #ifdef ARDUINO_ESP8266_WIFIO
215 #error "This board is currently not supported"
216 #endif
217 
218 #endif /* SETTINGS_H */
version_helper.h
macros.h