2014-03-29 00:54:51 +01:00
/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2018-04-10 11:34:43 +02:00
This program is free software ; you can redistribute it and / or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation ; either version 2 of the License , or
( at your option ) any later version .
This program is distributed in the hope that it will be useful ,
but WITHOUT ANY WARRANTY ; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE . See the
GNU General Public License for more details .
You should have received a copy of the GNU General Public License
along with this program ; if not , write to the Free Software
Foundation , Inc . , 59 Temple Place , Suite 330 , Boston , MA 02111 - 1307 USA
2014-03-29 00:54:51 +01:00
Contact information
- - - - - - - - - - - - - - - - - - -
Circuits At Home , LTD
Web : http : //www.circuitsathome.com
e - mail : support @ circuitsathome . com
2013-09-23 10:50:38 +02:00
*/
2013-09-29 22:07:44 +02:00
# ifndef USB_HOST_SHIELD_SETTINGS_H
2013-11-24 14:56:34 +01:00
# define USB_HOST_SHIELD_SETTINGS_H
2013-09-23 10:50:38 +02:00
# include "macros.h"
2017-11-09 19:13:42 +01:00
////////////////////////////////////////////////////////////////////////////////
// SPI Configuration
////////////////////////////////////////////////////////////////////////////////
2017-11-09 19:14:51 +01:00
# ifndef USB_SPI
2017-11-09 19:13:42 +01:00
# define USB_SPI SPI
//#define USB_SPI SPI1
2017-11-09 19:14:51 +01:00
# endif
2017-11-09 19:13:42 +01:00
2013-09-23 10:50:38 +02:00
////////////////////////////////////////////////////////////////////////////////
2013-09-30 02:44:22 +02:00
// DEBUGGING
2013-09-23 10:50:38 +02:00
////////////////////////////////////////////////////////////////////////////////
2013-09-30 02:44:22 +02:00
/* Set this to 1 to activate serial debugging */
2013-12-26 17:21:31 +01:00
# define ENABLE_UHS_DEBUGGING 0
2013-09-30 02:44:22 +02:00
2013-09-30 07:13:11 +02:00
/* This can be used to select which serial port to use for debugging if
* multiple serial ports are available .
* For example Serial3 .
*/
2013-09-23 10:50:38 +02:00
# ifndef USB_HOST_SERIAL
# define USB_HOST_SERIAL Serial
# endif
2013-09-30 02:44:22 +02:00
////////////////////////////////////////////////////////////////////////////////
2013-09-30 07:13:11 +02:00
// Manual board activation
2013-09-30 02:44:22 +02:00
////////////////////////////////////////////////////////////////////////////////
/* Set this to 1 if you are using an Arduino Mega ADK board with MAX3421e built-in */
2013-10-09 17:13:37 +02:00
# define USE_UHS_MEGA_ADK 0 // If you are using Arduino 1.5.5 or newer there is no need to do this manually
2013-09-30 02:44:22 +02:00
/* Set this to 1 if you are using a Black Widdow */
# define USE_UHS_BLACK_WIDDOW 0
2013-09-23 10:50:38 +02:00
2013-10-12 16:36:03 +02:00
/* Set this to a one to use the xmem2 lock. This is needed for multitasking and threading */
2013-10-08 17:36:15 +02:00
# define USE_XMEM_SPI_LOCK 0
2013-12-30 16:19:34 +01:00
////////////////////////////////////////////////////////////////////////////////
// Wii IR camera
////////////////////////////////////////////////////////////////////////////////
/* Set this to 1 to activate code for the Wii IR camera */
# define ENABLE_WII_IR_CAMERA 0
2013-09-23 10:50:38 +02:00
////////////////////////////////////////////////////////////////////////////////
// MASS STORAGE
////////////////////////////////////////////////////////////////////////////////
// <<<<<<<<<<<<<<<< IMPORTANT >>>>>>>>>>>>>>>
// Set this to 1 to support single LUN devices, and save RAM. -- I.E. thumb drives.
// Each LUN needs ~13 bytes to be able to track the state of each unit.
# ifndef MASS_MAX_SUPPORTED_LUN
# define MASS_MAX_SUPPORTED_LUN 8
# endif
2013-11-24 14:56:34 +01:00
////////////////////////////////////////////////////////////////////////////////
// Set to 1 to use the faster spi4teensy3 driver.
////////////////////////////////////////////////////////////////////////////////
# ifndef USE_SPI4TEENSY3
# define USE_SPI4TEENSY3 1
# endif
2017-08-14 09:39:38 +02:00
// Disabled on the Teensy LC, as it is incompatible for now
# if defined(__MKL26Z64__)
2015-07-21 21:10:49 +02:00
# undef USE_SPI4TEENSY3
# define USE_SPI4TEENSY3 0
# endif
2013-09-23 10:50:38 +02:00
////////////////////////////////////////////////////////////////////////////////
// AUTOMATIC Settings
////////////////////////////////////////////////////////////////////////////////
2013-09-29 22:07:44 +02:00
2013-09-30 07:13:11 +02:00
// No user serviceable parts below this line.
// DO NOT change anything below here unless you are a developer!
2014-09-23 04:53:11 +02:00
# include "version_helper.h"
2013-09-23 10:50:38 +02:00
2014-02-25 11:47:59 +01:00
# if defined(__GNUC__) && defined(__AVR__)
2013-12-21 13:40:28 +01:00
# ifndef GCC_VERSION
2013-12-10 00:39:12 +01:00
# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
2013-12-21 13:40:28 +01:00
# endif
2013-12-10 00:39:12 +01:00
# if GCC_VERSION < 40602 // Test for GCC < 4.6.2
# ifdef PROGMEM
# undef PROGMEM
# define PROGMEM __attribute__((section(".progmem.data"))) // Workaround for http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34734#c4
# ifdef PSTR
# undef PSTR
# define PSTR(s) (__extension__({static const char __c[] PROGMEM = (s); &__c[0];})) // Copied from pgmspace.h in avr-libc source
# endif
# endif
# endif
# endif
2013-12-30 16:19:34 +01:00
# if !defined(DEBUG_USB_HOST) && ENABLE_UHS_DEBUGGING
# define DEBUG_USB_HOST
# endif
# if !defined(WIICAMERA) && ENABLE_WII_IR_CAMERA
# define WIICAMERA
# endif
2014-02-27 09:10:46 +01:00
// To use some other locking (e.g. freertos),
// define XMEM_ACQUIRE_SPI and XMEM_RELEASE_SPI to point to your lock and unlock.
// NOTE: NO argument is passed. You have to do this within your routine for
// whatever you are using to lock and unlock.
# if !defined(XMEM_ACQUIRE_SPI)
2014-02-22 18:52:57 +01:00
# if USE_XMEM_SPI_LOCK || defined(USE_MULTIPLE_APP_API)
2013-10-08 17:36:15 +02:00
# include <xmem.h>
# else
# define XMEM_ACQUIRE_SPI() (void(0))
# define XMEM_RELEASE_SPI() (void(0))
# endif
2014-02-27 09:10:46 +01:00
# endif
2013-10-08 17:36:15 +02:00
2014-02-22 18:52:57 +01:00
# if !defined(EXT_RAM) && defined(EXT_RAM_STACK) || defined(EXT_RAM_HEAP)
# include <xmem.h>
# else
# define EXT_RAM 0
# endif
2013-10-08 17:36:15 +02:00
2017-08-14 09:39:38 +02:00
# if defined(CORE_TEENSY) && defined(KINETISK)
2013-11-24 14:56:34 +01:00
# define USING_SPI4TEENSY3 USE_SPI4TEENSY3
# else
# define USING_SPI4TEENSY3 0
# endif
2016-02-26 11:41:18 +01:00
# if ((defined(ARDUINO_SAM_DUE) && defined(__SAM3X8E__)) || defined(__ARDUINO_X86__) || ARDUINO >= 10600) && !USING_SPI4TEENSY3
# 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
# endif
# ifdef RBL_NRF51822
# include <nrf_gpio.h>
# include <SPI_Master.h>
# define SPI SPI_Master
2016-09-27 18:02:08 +02:00
# define MFK_CASTUINT8T (uint8_t) // RBLs return type for sizeof needs casting to uint8_t
2014-02-25 11:47:59 +01:00
# endif
2015-02-22 18:25:22 +01:00
# if defined(__PIC32MX__) || defined(__PIC32MZ__)
2014-09-26 05:14:04 +02:00
# include <../../../../hardware/pic32/libraries/SPI/SPI.h> // Hack to use the SPI library
2014-02-25 11:47:59 +01:00
# endif
2018-01-14 15:21:27 +01:00
# if defined(ESP8266) || defined(ESP32)
# define MFK_CASTUINT8T (uint8_t) // ESP return type for sizeof needs casting to uint8_t
# endif
2015-10-13 13:35:26 +02:00
# ifdef STM32F4
# include "stm32f4xx_hal.h"
extern SPI_HandleTypeDef SPI_Handle ; // Needed to be declared in your main.cpp
# endif
2016-04-19 16:54:31 +02:00
// Fix defines on Arduino Due
# ifdef ARDUINO_SAM_DUE
# ifdef tokSETUP
# undef tokSETUP
# endif
# ifdef tokIN
# undef tokIN
# endif
# ifdef tokOUT
# undef tokOUT
# endif
# ifdef tokINHS
# undef tokINHS
# endif
# ifdef tokOUTHS
# undef tokOUTHS
# endif
# endif
2016-09-27 18:02:08 +02:00
// Set defaults
# ifndef MFK_CASTUINT8T
# define MFK_CASTUINT8T
# endif
2016-10-25 07:06:15 +02:00
// Workaround issue: https://github.com/esp8266/Arduino/issues/2078
# ifdef ESP8266
# undef PROGMEM
# define PROGMEM
# undef PSTR
# define PSTR(s) (s)
# undef pgm_read_byte
# define pgm_read_byte(addr) (*reinterpret_cast<const uint8_t*>(addr))
# undef pgm_read_word
# define pgm_read_word(addr) (*reinterpret_cast<const uint16_t*>(addr))
# endif
2016-10-25 08:38:24 +02:00
# ifdef ARDUINO_ESP8266_WIFIO
# error "This board is currently not supported"
# endif
2015-03-12 23:10:04 +01:00
# endif /* SETTINGS_H */