Takumi Odashima / ArduinoUsbHostShield

Dependents:   USBHOST_PS5

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers settings.h Source File

settings.h

00001 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
00002 
00003 This program is free software; you can redistribute it and/or modify
00004 it under the terms of the GNU General Public License as published by
00005 the Free Software Foundation; either version 2 of the License, or
00006 (at your option) any later version.
00007 
00008 This program is distributed in the hope that it will be useful,
00009 but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 GNU General Public License for more details.
00012 
00013 You should have received a copy of the GNU General Public License
00014 along with this program; if not, write to the Free Software
00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00016 
00017 Contact information
00018 -------------------
00019 
00020 Circuits At Home, LTD
00021 Web      :  http://www.circuitsathome.com
00022 e-mail   :  support@circuitsathome.com
00023  */
00024 
00025 /*
00026 warning
00027 #define _usb_h_
00028 #define MBED_H
00029 */
00030 
00031 #ifndef USB_HOST_SHIELD_SETTINGS_H
00032 #define USB_HOST_SHIELD_SETTINGS_H
00033 #include "macros.h"
00034 
00035 ////////////////////////////////////////////////////////////////////////////////
00036 // SPI Configuration
00037 ////////////////////////////////////////////////////////////////////////////////
00038 #ifndef USB_SPI
00039 #define USB_SPI SPI
00040 //#define USB_SPI SPI1
00041 #endif
00042 
00043 ////////////////////////////////////////////////////////////////////////////////
00044 // DEBUGGING
00045 ////////////////////////////////////////////////////////////////////////////////
00046 
00047 /* Set this to 1 to activate serial debugging */
00048 #define ENABLE_UHS_DEBUGGING 0
00049 
00050 /* This can be used to select which serial port to use for debugging if
00051  * multiple serial ports are available.
00052  * For example Serial3.
00053  */
00054 
00055 #define USB_HOST_SERIAL //
00056 #ifndef USB_HOST_SERIAL
00057 #define USB_HOST_SERIAL //
00058 #endif
00059 
00060 ////////////////////////////////////////////////////////////////////////////////
00061 // Manual board activation
00062 ////////////////////////////////////////////////////////////////////////////////
00063 
00064 /* Set this to 1 if you are using an Arduino Mega ADK board with MAX3421e built-in */
00065 #define USE_UHS_MEGA_ADK 0 // If you are using Arduino 1.5.5 or newer there is no need to do this manually
00066 
00067 /* Set this to 1 if you are using a Black Widdow */
00068 #define USE_UHS_BLACK_WIDDOW 0
00069 
00070 /* Set this to a one to use the xmem2 lock. This is needed for multitasking and threading */
00071 #define USE_XMEM_SPI_LOCK 0
00072 
00073 ////////////////////////////////////////////////////////////////////////////////
00074 // Wii IR camera
00075 ////////////////////////////////////////////////////////////////////////////////
00076 
00077 /* Set this to 1 to activate code for the Wii IR camera */
00078 #define ENABLE_WII_IR_CAMERA 0
00079 
00080 ////////////////////////////////////////////////////////////////////////////////
00081 // MASS STORAGE
00082 ////////////////////////////////////////////////////////////////////////////////
00083 // <<<<<<<<<<<<<<<< IMPORTANT >>>>>>>>>>>>>>>
00084 // Set this to 1 to support single LUN devices, and save RAM. -- I.E. thumb drives.
00085 // Each LUN needs ~13 bytes to be able to track the state of each unit.
00086 #ifndef MASS_MAX_SUPPORTED_LUN
00087 #define MASS_MAX_SUPPORTED_LUN 8
00088 #endif
00089 
00090 ////////////////////////////////////////////////////////////////////////////////
00091 // Set to 1 to use the faster spi4teensy3 driver.
00092 ////////////////////////////////////////////////////////////////////////////////
00093 #ifndef USE_SPI4TEENSY3
00094 #define USE_SPI4TEENSY3 1
00095 #endif
00096 
00097 // Disabled on the Teensy LC, as it is incompatible for now
00098 #if defined(__MKL26Z64__)
00099 #undef USE_SPI4TEENSY3
00100 #define USE_SPI4TEENSY3 0
00101 #endif
00102 
00103 ////////////////////////////////////////////////////////////////////////////////
00104 // AUTOMATIC Settings
00105 ////////////////////////////////////////////////////////////////////////////////
00106 
00107 // No user serviceable parts below this line.
00108 // DO NOT change anything below here unless you are a developer!
00109 
00110 #include "version_helper.h"
00111 
00112 #if defined(__GNUC__) && defined(__AVR__)
00113 #ifndef GCC_VERSION
00114 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
00115 #endif
00116 #if GCC_VERSION < 40602 // Test for GCC < 4.6.2
00117 #ifdef PROGMEM
00118 #undef PROGMEM
00119 #define PROGMEM __attribute__((section(".progmem.data"))) // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734#c4
00120 #ifdef PSTR
00121 #undef PSTR
00122 #define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0]; })) // Copied from pgmspace.h in avr-libc source
00123 #endif
00124 #endif
00125 #endif
00126 #endif
00127 
00128 #if !defined(DEBUG_USB_HOST) && ENABLE_UHS_DEBUGGING
00129 #define DEBUG_USB_HOST
00130 #endif
00131 
00132 #if !defined(WIICAMERA) && ENABLE_WII_IR_CAMERA
00133 #define WIICAMERA
00134 #endif
00135 
00136 // To use some other locking (e.g. freertos),
00137 // define XMEM_ACQUIRE_SPI and XMEM_RELEASE_SPI to point to your lock and unlock.
00138 // NOTE: NO argument is passed. You have to do this within your routine for
00139 // whatever you are using to lock and unlock.
00140 #if !defined(XMEM_ACQUIRE_SPI)
00141 #if USE_XMEM_SPI_LOCK || defined(USE_MULTIPLE_APP_API)
00142 #include <xmem.h>
00143 #else
00144 #define XMEM_ACQUIRE_SPI() (void(0))
00145 #define XMEM_RELEASE_SPI() (void(0))
00146 #endif
00147 #endif
00148 
00149 #if !defined(EXT_RAM) && defined(EXT_RAM_STACK) || defined(EXT_RAM_HEAP)
00150 #include <xmem.h>
00151 #else
00152 #define EXT_RAM 0
00153 #endif
00154 
00155 #if defined(CORE_TEENSY) && defined(KINETISK)
00156 #define USING_SPI4TEENSY3 USE_SPI4TEENSY3
00157 #else
00158 #define USING_SPI4TEENSY3 0
00159 #endif
00160 
00161 #if ((defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)) || defined(__ARDUINO_X86__) || ARDUINO >= 10600) && !USING_SPI4TEENSY3
00162 #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
00163 #endif
00164 #ifdef RBL_NRF51822
00165 #include <nrf_gpio.h>
00166 #include <SPI_Master.h>
00167 #define SPI SPI_Master
00168 #define MFK_CASTUINT8T (uint8_t) // RBLs return type for sizeof needs casting to uint8_t
00169 #endif
00170 #if defined(__PIC32MX__) || defined(__PIC32MZ__)
00171 #include <../../../../hardware/pic32/libraries/SPI/SPI.h> // Hack to use the SPI library
00172 #endif
00173 
00174 #if defined(ESP8266) || defined(ESP32)
00175 #define MFK_CASTUINT8T (uint8_t) // ESP return type for sizeof needs casting to uint8_t
00176 #endif
00177 
00178 /*
00179 #ifdef STM32F4
00180 #include "stm32f4xx_hal.h"
00181 extern SPI_HandleTypeDef SPI_Handle; // Needed to be declared in your main.cpp
00182 #endif
00183 */
00184 
00185 // Fix defines on Arduino Due
00186 #ifdef ARDUINO_SAM_DUE
00187 #ifdef tokSETUP
00188 #undef tokSETUP
00189 #endif
00190 #ifdef tokIN
00191 #undef tokIN
00192 #endif
00193 #ifdef tokOUT
00194 #undef tokOUT
00195 #endif
00196 #ifdef tokINHS
00197 #undef tokINHS
00198 #endif
00199 #ifdef tokOUTHS
00200 #undef tokOUTHS
00201 #endif
00202 #endif
00203 
00204 // Set defaults
00205 #ifndef MFK_CASTUINT8T
00206 #define MFK_CASTUINT8T
00207 #endif
00208 
00209 // Workaround issue: https://github.com/esp8266/Arduino/issues/2078
00210 #ifdef ESP8266
00211 #undef PROGMEM
00212 #define PROGMEM
00213 #undef PSTR
00214 #define PSTR(s) (s)
00215 #undef pgm_read_byte
00216 #define pgm_read_byte(addr) (*reinterpret_cast<const uint8_t *>(addr))
00217 #undef pgm_read_word
00218 #define pgm_read_word(addr) (*reinterpret_cast<const uint16_t *>(addr))
00219 #endif
00220 
00221 #ifdef ARDUINO_ESP8266_WIFIO
00222 #error "This board is currently not supported"
00223 #endif
00224 
00225 #endif /* SETTINGS_H */