Zoltan Hudak / UsbHostMAX3421E

Dependents:   UsbHostMAX3421E_Hello

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