diff options
author | midopple <mdoppler@gmx.at> | 2012-03-04 18:01:43 +0100 |
---|---|---|
committer | midopple <mdoppler@gmx.at> | 2012-03-04 18:01:43 +0100 |
commit | bcef226413df81e24b68d5c68420cc88bbed10ff (patch) | |
tree | e516a1cfa71df6320e80debb85b596a0e4c4c8f9 | |
parent | 0ada66f1123e12de8a4b31b599571e7255cf18bf (diff) | |
parent | 0a47e2d0b6493eeba856d9c71bafc9f97abd3ec3 (diff) |
Merge commit 'from changwoo/arduino-1.0-compatibility' into experimental
-rw-r--r-- | README | 4 | ||||
-rw-r--r-- | Sprinter/SdFat.h | 4 | ||||
-rw-r--r-- | Sprinter/SdFatUtil.h | 2 | ||||
-rw-r--r-- | Sprinter/SdFile.cpp | 33 |
4 files changed, 28 insertions, 15 deletions
@@ -40,8 +40,8 @@ Software installation 1. Install the required packages (gcc-avr, avr-libc, etc.)
sudo apt-get install arduino-core
-2. Get the arduino software version 0018 (0023 works for RAMPS), uncompress it in a directory
-Arduino software v1 DOES NOT work with Sprinter yet!
+2. Get the arduino software version 0018 (0023 works for RAMPS), uncompress it in a directory.
+Arduino software v1 has not been tested much, but is known to work with some boards.
http://www.arduino.cc/en/Main/Software
3. Get the sanguino software, version 0018
diff --git a/Sprinter/SdFat.h b/Sprinter/SdFat.h index 048fa71..7a11bba 100644 --- a/Sprinter/SdFat.h +++ b/Sprinter/SdFat.h @@ -283,7 +283,11 @@ class SdFile : public Print { }
/** \return SdVolume that contains this file. */
SdVolume* volume(void) const {return vol_;}
+#if ARDUINO >= 100
+ size_t write(uint8_t b);
+#else
void write(uint8_t b);
+#endif
int16_t write(const void* buf, uint16_t nbyte);
void write(const char* str);
void write_P(PGM_P str);
diff --git a/Sprinter/SdFatUtil.h b/Sprinter/SdFatUtil.h index 8bf9048..de3fee3 100644 --- a/Sprinter/SdFatUtil.h +++ b/Sprinter/SdFatUtil.h @@ -55,7 +55,7 @@ static int FreeRam(void) { * \param[in] str Pointer to string stored in flash memory.
*/
static NOINLINE void SerialPrint_P(PGM_P str) {
- for (uint8_t c; (c = pgm_read_byte(str)); str++) Serial.print(c);
+ for (uint8_t c; (c = pgm_read_byte(str)); str++) Serial.print(char(c));
}
//------------------------------------------------------------------------------
/**
diff --git a/Sprinter/SdFile.cpp b/Sprinter/SdFile.cpp index 0a27159..13f4c6a 100644 --- a/Sprinter/SdFile.cpp +++ b/Sprinter/SdFile.cpp @@ -213,7 +213,7 @@ void SdFile::ls(uint8_t flags, uint8_t indent) { if (!DIR_IS_FILE_OR_SUBDIR(p)) continue; // print any indent spaces - for (int8_t i = 0; i < indent; i++) Serial.print(' '); + for (int8_t i = 0; i < indent; i++) Serial.print(char(' ')); // print file name with possible blank fill printDirName(*p, flags & (LS_DATE | LS_SIZE) ? 14 : 0); @@ -221,12 +221,12 @@ void SdFile::ls(uint8_t flags, uint8_t indent) { // print modify date/time if requested if (flags & LS_DATE) { printFatDate(p->lastWriteDate); - Serial.print(' '); + Serial.print(char(' ')); printFatTime(p->lastWriteTime); } // print size if requested if (!DIR_IS_SUBDIR(p) && (flags & LS_SIZE)) { - Serial.print(' '); + Serial.print(char(' ')); Serial.print(p->fileSize); } Serial.println(); @@ -587,18 +587,18 @@ void SdFile::printDirName(const dir_t& dir, uint8_t width) { for (uint8_t i = 0; i < 11; i++) { if (dir.name[i] == ' ')continue; if (i == 8) { - Serial.print('.'); + Serial.print(char('.')); w++; } - Serial.print(dir.name[i]); + Serial.print(char(dir.name[i])); w++; } if (DIR_IS_SUBDIR(&dir)) { - Serial.print('/'); + Serial.print(char('/')); w++; } while (w < width) { - Serial.print(' '); + Serial.print(char(' ')); w++; } } @@ -611,9 +611,9 @@ void SdFile::printDirName(const dir_t& dir, uint8_t width) { */ void SdFile::printFatDate(uint16_t fatDate) { Serial.print(FAT_YEAR(fatDate)); - Serial.print('-'); + Serial.print(char('-')); printTwoDigits(FAT_MONTH(fatDate)); - Serial.print('-'); + Serial.print(char('-')); printTwoDigits(FAT_DAY(fatDate)); } //------------------------------------------------------------------------------ @@ -625,9 +625,9 @@ void SdFile::printFatDate(uint16_t fatDate) { */ void SdFile::printFatTime(uint16_t fatTime) { printTwoDigits(FAT_HOUR(fatTime)); - Serial.print(':'); + Serial.print(char(':')); printTwoDigits(FAT_MINUTE(fatTime)); - Serial.print(':'); + Serial.print(char(':')); printTwoDigits(FAT_SECOND(fatTime)); } //------------------------------------------------------------------------------ @@ -1219,8 +1219,17 @@ int16_t SdFile::write(const void* buf, uint16_t nbyte) { * * Use SdFile::writeError to check for errors. */ -void SdFile::write(uint8_t b) { +#if ARDUINO >= 100 +size_t SdFile::write(uint8_t b) +#else +void SdFile::write(uint8_t b) +#endif +{ +#if ARDUINO >= 100 + return (size_t) write(&b, 1); +#else write(&b, 1); +#endif } //------------------------------------------------------------------------------ /** |