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