Merge pull request #147 from changwoo/arduino-1.0-compatibility
Arduino 1.0 compatibility for experimental
This commit is contained in:
commit
0a47e2d0b6
4 changed files with 28 additions and 15 deletions
4
README
4
README
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in a new issue