SdFatConfig.h

Sat, 07 Nov 2015 13:24:46 +0100

author
mbayer
date
Sat, 07 Nov 2015 13:24:46 +0100
changeset 1
b584642d4f58
parent 0
2c8ba1964db7
permissions
-rw-r--r--

several modifications to support laser enable - still needs cleanup

0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
1 /* Arduino SdFat Library
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
2 * Copyright (C) 2009 by William Greiman
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
3 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
4 * This file is part of the Arduino SdFat Library
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
5 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
6 * This Library is free software: you can redistribute it and/or modify
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
8 * the Free Software Foundation, either version 3 of the License, or
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
9 * (at your option) any later version.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
10 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
11 * This Library is distributed in the hope that it will be useful,
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
14 * GNU General Public License for more details.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
15 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
17 * along with the Arduino SdFat Library. If not, see
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
18 * <http://www.gnu.org/licenses/>.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
19 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
20 /**
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
21 * \file
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
22 * \brief configuration definitions
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
23 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
24 #include "Marlin.h"
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
25 #ifdef SDSUPPORT
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
26
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
27 #ifndef SdFatConfig_h
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
28 #define SdFatConfig_h
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
29 #include <stdint.h>
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
30 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
31 /**
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
32 * To use multiple SD cards set USE_MULTIPLE_CARDS nonzero.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
33 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
34 * Using multiple cards costs 400 - 500 bytes of flash.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
35 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
36 * Each card requires about 550 bytes of SRAM so use of a Mega is recommended.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
37 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
38 #define USE_MULTIPLE_CARDS 0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
39 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
40 /**
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
41 * Call flush for endl if ENDL_CALLS_FLUSH is nonzero
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
42 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
43 * The standard for iostreams is to call flush. This is very costly for
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
44 * SdFat. Each call to flush causes 2048 bytes of I/O to the SD.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
45 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
46 * SdFat has a single 512 byte buffer for SD I/O so it must write the current
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
47 * data block to the SD, read the directory block from the SD, update the
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
48 * directory entry, write the directory block to the SD and read the data
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
49 * block back into the buffer.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
50 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
51 * The SD flash memory controller is not designed for this many rewrites
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
52 * so performance may be reduced by more than a factor of 100.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
53 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
54 * If ENDL_CALLS_FLUSH is zero, you must call flush and/or close to force
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
55 * all data to be written to the SD.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
56 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
57 #define ENDL_CALLS_FLUSH 0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
58 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
59 /**
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
60 * Allow use of deprecated functions if ALLOW_DEPRECATED_FUNCTIONS is nonzero
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
61 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
62 #define ALLOW_DEPRECATED_FUNCTIONS 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
63 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
64 /**
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
65 * Allow FAT12 volumes if FAT12_SUPPORT is nonzero.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
66 * FAT12 has not been well tested.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
67 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
68 #define FAT12_SUPPORT 0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
69 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
70 /**
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
71 * SPI init rate for SD initialization commands. Must be 5 (F_CPU/64)
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
72 * or 6 (F_CPU/128).
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
73 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
74 #define SPI_SD_INIT_RATE 5
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
75 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
76 /**
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
77 * Set the SS pin high for hardware SPI. If SS is chip select for another SPI
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
78 * device this will disable that device during the SD init phase.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
79 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
80 #define SET_SPI_SS_HIGH 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
81 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
82 /**
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
83 * Define MEGA_SOFT_SPI nonzero to use software SPI on Mega Arduinos.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
84 * Pins used are SS 10, MOSI 11, MISO 12, and SCK 13.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
85 *
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
86 * MEGA_SOFT_SPI allows an unmodified Adafruit GPS Shield to be used
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
87 * on Mega Arduinos. Software SPI works well with GPS Shield V1.1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
88 * but many SD cards will fail with GPS Shield V1.0.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
89 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
90 #define MEGA_SOFT_SPI 0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
91 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
92 /**
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
93 * Set USE_SOFTWARE_SPI nonzero to always use software SPI.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
94 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
95 #define USE_SOFTWARE_SPI 0
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
96 // define software SPI pins so Mega can use unmodified 168/328 shields
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
97 /** Software SPI chip select pin for the SD */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
98 uint8_t const SOFT_SPI_CS_PIN = 10;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
99 /** Software SPI Master Out Slave In pin */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
100 uint8_t const SOFT_SPI_MOSI_PIN = 11;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
101 /** Software SPI Master In Slave Out pin */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
102 uint8_t const SOFT_SPI_MISO_PIN = 12;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
103 /** Software SPI Clock pin */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
104 uint8_t const SOFT_SPI_SCK_PIN = 13;
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
105 //------------------------------------------------------------------------------
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
106 /**
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
107 * The __cxa_pure_virtual function is an error handler that is invoked when
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
108 * a pure virtual function is called.
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
109 */
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
110 #define USE_CXA_PURE_VIRTUAL 1
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
111 #endif // SdFatConfig_h
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
112
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
113
2c8ba1964db7 Initial code from reprappro Marlin repository
mbayer
parents:
diff changeset
114 #endif

mercurial