Revert "Move Sd library out into library"

master
galexander1 9 years ago
parent ccdb086fc8
commit d4880a9e60

@ -26,9 +26,6 @@ before_script:
- cd $TRAVIS_BUILD_DIR - cd $TRAVIS_BUILD_DIR
# ino needs files in src directory # ino needs files in src directory
- ln -s Marlin src - ln -s Marlin src
- mkdir lib
- ln -s ../ArduinoAddons/Arduino_1.0.x/libraries/SdFat lib/SdFat
- ls -la lib/SdFat
# remove Marlin.pde as it confuses ino after it finds Marlin.ino # remove Marlin.pde as it confuses ino after it finds Marlin.ino
- rm Marlin/Marlin.pde - rm Marlin/Marlin.pde
script: script:

@ -1,5 +0,0 @@
#ifndef AT90USB
#define HardwareSerial_h // trick to disable the standard HWserial
#endif
#include <Arduino.h>

@ -54,8 +54,3 @@
#if defined(DIGIPOT_I2C) #if defined(DIGIPOT_I2C)
#include <Wire.h> #include <Wire.h>
#endif #endif
#if defined(HEATER_0_USES_MAX6675) || defined(SDSUPPORT)
#include <Sd2Card.h>
#endif

@ -17,8 +17,9 @@
* along with the Arduino Sd2Card Library. If not, see * along with the Arduino Sd2Card Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "SdFat.h" #include "Marlin.h"
#ifdef SDSUPPORT
#include "Sd2Card.h" #include "Sd2Card.h"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#ifndef SOFTWARE_SPI #ifndef SOFTWARE_SPI
@ -718,3 +719,5 @@ bool Sd2Card::writeStop() {
chipSelectHigh(); chipSelectHigh();
return false; return false;
} }
#endif

@ -18,6 +18,9 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "Marlin.h"
#ifdef SDSUPPORT
#ifndef Sd2Card_h #ifndef Sd2Card_h
#define Sd2Card_h #define Sd2Card_h
/** /**
@ -235,3 +238,6 @@ class Sd2Card {
bool writeData(uint8_t token, const uint8_t* src); bool writeData(uint8_t token, const uint8_t* src);
}; };
#endif // Sd2Card_h #endif // Sd2Card_h
#endif

@ -18,6 +18,9 @@
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
// Warning this file was generated by a program. // Warning this file was generated by a program.
#include "Marlin.h"
#ifdef SDSUPPORT
#ifndef Sd2PinMap_h #ifndef Sd2PinMap_h
#define Sd2PinMap_h #define Sd2PinMap_h
#include <avr/io.h> #include <avr/io.h>
@ -360,3 +363,6 @@ static inline __attribute__((always_inline))
} }
} }
#endif // Sd2PinMap_h #endif // Sd2PinMap_h
#endif

@ -17,8 +17,9 @@
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "SdFat.h"
#include <Print.h> #include "Marlin.h"
#ifdef SDSUPPORT
#include "SdBaseFile.h" #include "SdBaseFile.h"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -314,14 +315,14 @@ void SdBaseFile::getpos(fpos_t* pos) {
* \param[in] indent Amount of space before file name. Used for recursive * \param[in] indent Amount of space before file name. Used for recursive
* list to indicate subdirectory level. * list to indicate subdirectory level.
*/ */
void SdBaseFile::ls(Print *p, uint8_t flags, uint8_t indent) { void SdBaseFile::ls(uint8_t flags, uint8_t indent) {
rewind(); rewind();
int8_t status; int8_t status;
while ((status = lsPrintNext( p, flags, indent))) { while ((status = lsPrintNext( flags, indent))) {
if (status > 1 && (flags & LS_R)) { if (status > 1 && (flags & LS_R)) {
uint16_t index = curPosition()/32 - 1; uint16_t index = curPosition()/32 - 1;
SdBaseFile s; SdBaseFile s;
if (s.open(this, index, O_READ)) s.ls( p, flags, indent + 2); if (s.open(this, index, O_READ)) s.ls( flags, indent + 2);
seekSet(32 * (index + 1)); seekSet(32 * (index + 1));
} }
} }
@ -329,8 +330,7 @@ void SdBaseFile::ls(Print *p, uint8_t flags, uint8_t indent) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// saves 32 bytes on stack for ls recursion // saves 32 bytes on stack for ls recursion
// return 0 - EOF, 1 - normal file, or 2 - directory // return 0 - EOF, 1 - normal file, or 2 - directory
int8_t SdBaseFile::lsPrintNext( Print *p, uint8_t flags, uint8_t indent) { int8_t SdBaseFile::lsPrintNext( uint8_t flags, uint8_t indent) {
Print &MYSERIAL = *p;
dir_t dir; dir_t dir;
uint8_t w = 0; uint8_t w = 0;
@ -365,9 +365,9 @@ int8_t SdBaseFile::lsPrintNext( Print *p, uint8_t flags, uint8_t indent) {
// print modify date/time if requested // print modify date/time if requested
if (flags & LS_DATE) { if (flags & LS_DATE) {
MYSERIAL.write(' '); MYSERIAL.write(' ');
printFatDate( p, dir.lastWriteDate); printFatDate( dir.lastWriteDate);
MYSERIAL.write(' '); MYSERIAL.write(' ');
printFatTime( p, dir.lastWriteTime); printFatTime( dir.lastWriteTime);
} }
// print size if requested // print size if requested
if (!DIR_IS_SUBDIR(&dir) && (flags & LS_SIZE)) { if (!DIR_IS_SUBDIR(&dir) && (flags & LS_SIZE)) {
@ -939,8 +939,8 @@ int SdBaseFile::peek() {
* \param[in] width Blank fill name if length is less than \a width. * \param[in] width Blank fill name if length is less than \a width.
* \param[in] printSlash Print '/' after directory names if true. * \param[in] printSlash Print '/' after directory names if true.
*/ */
void SdBaseFile::printDirName(Print *p, const dir_t& dir, uint8_t width, bool printSlash) { void SdBaseFile::printDirName(const dir_t& dir,
Print &MYSERIAL = *p; uint8_t width, bool printSlash) {
uint8_t w = 0; uint8_t w = 0;
for (uint8_t i = 0; i < 11; i++) { for (uint8_t i = 0; i < 11; i++) {
if (dir.name[i] == ' ')continue; if (dir.name[i] == ' ')continue;
@ -962,8 +962,7 @@ void SdBaseFile::printDirName(Print *p, const dir_t& dir, uint8_t width, bool pr
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// print uint8_t with width 2 // print uint8_t with width 2
static void print2u( Print *p, uint8_t v) { static void print2u( uint8_t v) {
Print &MYSERIAL = *p;
if (v < 10) MYSERIAL.write('0'); if (v < 10) MYSERIAL.write('0');
MYSERIAL.print(v, DEC); MYSERIAL.print(v, DEC);
} }
@ -983,14 +982,12 @@ static void print2u( Print *p, uint8_t v) {
* \param[in] pr Print stream for output. * \param[in] pr Print stream for output.
* \param[in] fatDate The date field from a directory entry. * \param[in] fatDate The date field from a directory entry.
*/ */
void SdBaseFile::printFatDate(Print *p, uint16_t fatDate) { void SdBaseFile::printFatDate(uint16_t fatDate) {
Print &MYSERIAL = *p;
MYSERIAL.print(FAT_YEAR(fatDate)); MYSERIAL.print(FAT_YEAR(fatDate));
MYSERIAL.write('-'); MYSERIAL.write('-');
print2u( p, FAT_MONTH(fatDate)); print2u( FAT_MONTH(fatDate));
MYSERIAL.write('-'); MYSERIAL.write('-');
print2u( p, FAT_DAY(fatDate)); print2u( FAT_DAY(fatDate));
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -1001,14 +998,12 @@ void SdBaseFile::printFatDate(Print *p, uint16_t fatDate) {
* \param[in] pr Print stream for output. * \param[in] pr Print stream for output.
* \param[in] fatTime The time field from a directory entry. * \param[in] fatTime The time field from a directory entry.
*/ */
void SdBaseFile::printFatTime( Print *p, uint16_t fatTime) { void SdBaseFile::printFatTime( uint16_t fatTime) {
Print &MYSERIAL = *p; print2u( FAT_HOUR(fatTime));
print2u( p, FAT_HOUR(fatTime));
MYSERIAL.write(':'); MYSERIAL.write(':');
print2u( p, FAT_MINUTE(fatTime)); print2u( FAT_MINUTE(fatTime));
MYSERIAL.write(':'); MYSERIAL.write(':');
print2u( p, FAT_SECOND(fatTime)); print2u( FAT_SECOND(fatTime));
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** Print a file's name to Serial /** Print a file's name to Serial
@ -1016,8 +1011,7 @@ void SdBaseFile::printFatTime( Print *p, uint16_t fatTime) {
* \return The value one, true, is returned for success and * \return The value one, true, is returned for success and
* the value zero, false, is returned for failure. * the value zero, false, is returned for failure.
*/ */
bool SdBaseFile::printName(Print *p) { bool SdBaseFile::printName() {
Print &MYSERIAL = *p;
char name[13]; char name[13];
if (!getFilename(name)) return false; if (!getFilename(name)) return false;
MYSERIAL.print(name); MYSERIAL.print(name);
@ -1826,3 +1820,6 @@ int16_t SdBaseFile::write(const void* buf, uint16_t nbyte) {
#if ALLOW_DEPRECATED_FUNCTIONS && !defined(DOXYGEN) #if ALLOW_DEPRECATED_FUNCTIONS && !defined(DOXYGEN)
void (*SdBaseFile::oldDateTime_)(uint16_t& date, uint16_t& time) = 0; // NOLINT void (*SdBaseFile::oldDateTime_)(uint16_t& date, uint16_t& time) = 0; // NOLINT
#endif // ALLOW_DEPRECATED_FUNCTIONS #endif // ALLOW_DEPRECATED_FUNCTIONS
#endif

@ -17,12 +17,16 @@
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "Marlin.h"
#ifdef SDSUPPORT
#ifndef SdBaseFile_h #ifndef SdBaseFile_h
#define SdBaseFile_h #define SdBaseFile_h
/** /**
* \file * \file
* \brief SdBaseFile class * \brief SdBaseFile class
*/ */
#include "Marlin.h"
#include "SdFatConfig.h" #include "SdFatConfig.h"
#include "SdVolume.h" #include "SdVolume.h"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -170,8 +174,6 @@ static inline uint8_t FAT_SECOND(uint16_t fatTime) {
uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | (1 << 5) | 1; uint16_t const FAT_DEFAULT_DATE = ((2000 - 1980) << 9) | (1 << 5) | 1;
/** Default time for file timestamp is 1 am */ /** Default time for file timestamp is 1 am */
uint16_t const FAT_DEFAULT_TIME = (1 << 11); uint16_t const FAT_DEFAULT_TIME = (1 << 11);
class Print;
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** /**
* \class SdBaseFile * \class SdBaseFile
@ -264,7 +266,7 @@ class SdBaseFile {
bool isRoot() const { bool isRoot() const {
return type_ == FAT_FILE_TYPE_ROOT_FIXED || type_ == FAT_FILE_TYPE_ROOT32; return type_ == FAT_FILE_TYPE_ROOT_FIXED || type_ == FAT_FILE_TYPE_ROOT32;
} }
void ls( Print *p, uint8_t flags = 0, uint8_t indent = 0); void ls( uint8_t flags = 0, uint8_t indent = 0);
bool mkdir(SdBaseFile* dir, const char* path, bool pFlag = true); bool mkdir(SdBaseFile* dir, const char* path, bool pFlag = true);
// alias for backward compactability // alias for backward compactability
bool makeDir(SdBaseFile* dir, const char* path) { bool makeDir(SdBaseFile* dir, const char* path) {
@ -276,9 +278,9 @@ class SdBaseFile {
bool openNext(SdBaseFile* dirFile, uint8_t oflag); bool openNext(SdBaseFile* dirFile, uint8_t oflag);
bool openRoot(SdVolume* vol); bool openRoot(SdVolume* vol);
int peek(); int peek();
static void printFatDate(Print *p, uint16_t fatDate); static void printFatDate(uint16_t fatDate);
static void printFatTime(Print *p, uint16_t fatTime); static void printFatTime( uint16_t fatTime);
bool printName(Print *p); bool printName();
int16_t read(); int16_t read();
int16_t read(void* buf, uint16_t nbyte); int16_t read(void* buf, uint16_t nbyte);
int8_t readDir(dir_t* dir, char* longFilename); int8_t readDir(dir_t* dir, char* longFilename);
@ -350,7 +352,7 @@ class SdBaseFile {
bool addCluster(); bool addCluster();
bool addDirCluster(); bool addDirCluster();
dir_t* cacheDirEntry(uint8_t action); dir_t* cacheDirEntry(uint8_t action);
int8_t lsPrintNext( Print *p, uint8_t flags, uint8_t indent); int8_t lsPrintNext( uint8_t flags, uint8_t indent);
static bool make83Name(const char* str, uint8_t* name, const char** ptr); static bool make83Name(const char* str, uint8_t* name, const char** ptr);
bool mkdir(SdBaseFile* parent, const uint8_t dname[11]); bool mkdir(SdBaseFile* parent, const uint8_t dname[11]);
bool open(SdBaseFile* dirFile, const uint8_t dname[11], uint8_t oflag); bool open(SdBaseFile* dirFile, const uint8_t dname[11], uint8_t oflag);
@ -358,7 +360,7 @@ class SdBaseFile {
dir_t* readDirCache(); dir_t* readDirCache();
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// to be deleted // to be deleted
static void printDirName( Print *p, const dir_t& dir, static void printDirName( const dir_t& dir,
uint8_t width, bool printSlash); uint8_t width, bool printSlash);
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Deprecated functions - suppress cpplint warnings with NOLINT comment // Deprecated functions - suppress cpplint warnings with NOLINT comment
@ -478,3 +480,4 @@ class SdBaseFile {
}; };
#endif // SdBaseFile_h #endif // SdBaseFile_h
#endif

@ -21,6 +21,9 @@
* \file * \file
* \brief configuration definitions * \brief configuration definitions
*/ */
#include "Marlin.h"
#ifdef SDSUPPORT
#ifndef SdFatConfig_h #ifndef SdFatConfig_h
#define SdFatConfig_h #define SdFatConfig_h
#include <stdint.h> #include <stdint.h>
@ -115,3 +118,6 @@ uint8_t const SOFT_SPI_SCK_PIN = 13;
/** Total size of the buffer used to store the long filenames */ /** Total size of the buffer used to store the long filenames */
#define LONG_FILENAME_LENGTH (13*MAX_VFAT_ENTRIES+1) #define LONG_FILENAME_LENGTH (13*MAX_VFAT_ENTRIES+1)
#endif // SdFatConfig_h #endif // SdFatConfig_h
#endif

@ -17,6 +17,9 @@
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "Marlin.h"
#ifdef SDSUPPORT
#ifndef SdFatStructs_h #ifndef SdFatStructs_h
#define SdFatStructs_h #define SdFatStructs_h
@ -638,3 +641,6 @@ static inline uint8_t DIR_IS_FILE_OR_SUBDIR(const dir_t* dir) {
return (dir->attributes & DIR_ATT_VOLUME_ID) == 0; return (dir->attributes & DIR_ATT_VOLUME_ID) == 0;
} }
#endif // SdFatStructs_h #endif // SdFatStructs_h
#endif

@ -17,8 +17,9 @@
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "SdFat.h" #include "Marlin.h"
#include <Print.h>
#ifdef SDSUPPORT
#include "SdFatUtil.h" #include "SdFatUtil.h"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -49,8 +50,7 @@ int SdFatUtil::FreeRam() {
* \param[in] pr Print object for output. * \param[in] pr Print object for output.
* \param[in] str Pointer to string stored in flash memory. * \param[in] str Pointer to string stored in flash memory.
*/ */
void SdFatUtil::print_P( Print *p, PGM_P str) { void SdFatUtil::print_P( PGM_P str) {
Print &MYSERIAL = *p;
for (uint8_t c; (c = pgm_read_byte(str)); str++) MYSERIAL.write(c); for (uint8_t c; (c = pgm_read_byte(str)); str++) MYSERIAL.write(c);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -59,9 +59,8 @@ void SdFatUtil::print_P( Print *p, PGM_P str) {
* \param[in] pr Print object for output. * \param[in] pr Print object for output.
* \param[in] str Pointer to string stored in flash memory. * \param[in] str Pointer to string stored in flash memory.
*/ */
void SdFatUtil::println_P( Print *p, PGM_P str) { void SdFatUtil::println_P( PGM_P str) {
Print &MYSERIAL = *p; print_P( str);
print_P( p, str);
MYSERIAL.println(); MYSERIAL.println();
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -69,14 +68,15 @@ void SdFatUtil::println_P( Print *p, PGM_P str) {
* *
* \param[in] str Pointer to string stored in flash memory. * \param[in] str Pointer to string stored in flash memory.
*/ */
void SdFatUtil::SerialPrint_P( Print *p, PGM_P str) { void SdFatUtil::SerialPrint_P(PGM_P str) {
print_P(p, str); print_P(str);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
/** %Print a string in flash memory to Serial followed by a CR/LF. /** %Print a string in flash memory to Serial followed by a CR/LF.
* *
* \param[in] str Pointer to string stored in flash memory. * \param[in] str Pointer to string stored in flash memory.
*/ */
void SdFatUtil::SerialPrintln_P(Print *p, PGM_P str) { void SdFatUtil::SerialPrintln_P(PGM_P str) {
println_P( p, str); println_P( str);
} }
#endif

@ -17,19 +17,32 @@
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "Marlin.h"
#ifdef SDSUPPORT
#ifndef SdFatUtil_h #ifndef SdFatUtil_h
#define SdFatUtil_h #define SdFatUtil_h
/** /**
* \file * \file
* \brief Useful utility functions. * \brief Useful utility functions.
*/ */
#include "Marlin.h"
#include "MarlinSerial.h"
/** Store and print a string in flash memory.*/
#define PgmPrint(x) SerialPrint_P(PSTR(x))
/** Store and print a string in flash memory followed by a CR/LF.*/
#define PgmPrintln(x) SerialPrintln_P(PSTR(x))
namespace SdFatUtil { namespace SdFatUtil {
int FreeRam(); int FreeRam();
void print_P( Print *p, PGM_P str); void print_P( PGM_P str);
void println_P( Print *p, PGM_P str); void println_P( PGM_P str);
void SerialPrint_P(Print *p, PGM_P str); void SerialPrint_P(PGM_P str);
void SerialPrintln_P(Print *p, PGM_P str); void SerialPrintln_P(PGM_P str);
} }
using namespace SdFatUtil; // NOLINT using namespace SdFatUtil; // NOLINT
#endif // #define SdFatUtil_h #endif // #define SdFatUtil_h
#endif

@ -17,6 +17,9 @@
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "Marlin.h"
#ifdef SDSUPPORT
#include "SdFile.h" #include "SdFile.h"
/** Create a file object and open it in the current working directory. /** Create a file object and open it in the current working directory.
* *
@ -87,3 +90,6 @@ void SdFile::writeln_P(PGM_P str) {
write_P(str); write_P(str);
write_P(PSTR("\r\n")); write_P(PSTR("\r\n"));
} }
#endif

@ -21,6 +21,9 @@
* \file * \file
* \brief SdFile class * \brief SdFile class
*/ */
#include "Marlin.h"
#ifdef SDSUPPORT
#include "SdBaseFile.h" #include "SdBaseFile.h"
#include <Print.h> #include <Print.h>
#ifndef SdFile_h #ifndef SdFile_h
@ -46,3 +49,6 @@ class SdFile : public SdBaseFile, public Print {
void writeln_P(PGM_P str); void writeln_P(PGM_P str);
}; };
#endif // SdFile_h #endif // SdFile_h
#endif

@ -17,6 +17,9 @@
* along with the Arduino Sd2Card Library. If not, see * along with the Arduino Sd2Card Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "Marlin.h"
#ifdef SDSUPPORT
#ifndef SdInfo_h #ifndef SdInfo_h
#define SdInfo_h #define SdInfo_h
#include <stdint.h> #include <stdint.h>
@ -273,3 +276,5 @@ union csd_t {
csd2_t v2; csd2_t v2;
}; };
#endif // SdInfo_h #endif // SdInfo_h
#endif

@ -17,7 +17,9 @@
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "SdFat.h" #include "Marlin.h"
#ifdef SDSUPPORT
#include "SdVolume.h" #include "SdVolume.h"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
#if !USE_MULTIPLE_CARDS #if !USE_MULTIPLE_CARDS
@ -400,3 +402,4 @@ bool SdVolume::init(Sd2Card* dev, uint8_t part) {
fail: fail:
return false; return false;
} }
#endif

@ -17,6 +17,8 @@
* along with the Arduino SdFat Library. If not, see * along with the Arduino SdFat Library. If not, see
* <http://www.gnu.org/licenses/>. * <http://www.gnu.org/licenses/>.
*/ */
#include "Marlin.h"
#ifdef SDSUPPORT
#ifndef SdVolume_h #ifndef SdVolume_h
#define SdVolume_h #define SdVolume_h
/** /**
@ -209,3 +211,4 @@ class SdVolume {
#endif // ALLOW_DEPRECATED_FUNCTIONS #endif // ALLOW_DEPRECATED_FUNCTIONS
}; };
#endif // SdVolume #endif // SdVolume
#endif

@ -35,9 +35,8 @@
#include "watchdog.h" #include "watchdog.h"
#include "thermistortables.h" #include "thermistortables.h"
#ifdef HEATER_0_USES_MAX6675 #include "Sd2PinMap.h"
//#include <Sd2PinMap.h>
#endif
//=========================================================================== //===========================================================================
//=============================public variables============================ //=============================public variables============================

Loading…
Cancel
Save