make it compile with arduino 1.0 ; function is still untested.

This commit is contained in:
Bernhard 2011-12-01 16:38:01 +01:00
parent b0c3871750
commit 0bc9daa4f7
8 changed files with 675 additions and 651 deletions

View File

@ -5,7 +5,12 @@
// Licence: GPL // Licence: GPL
#define HardwareSerial_h // trick to disable the standard HWserial #define HardwareSerial_h // trick to disable the standard HWserial
#include <math.h> #include <math.h>
#include <WProgram.h> #if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "fastio.h" #include "fastio.h"
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#include "Configuration.h" #include "Configuration.h"

View File

@ -25,7 +25,11 @@
#include <string.h> #include <string.h>
#include <inttypes.h> #include <inttypes.h>
#include <math.h> #include <math.h>
#include "wiring.h" #if ARDUINO >= 100
#include "Arduino.h"
#else
#include "wiring.h"
#endif
#include "wiring_private.h" #include "wiring_private.h"
// this next line disables the entire HardwareSerial.cpp, // this next line disables the entire HardwareSerial.cpp,

View File

@ -17,8 +17,8 @@
* 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/>.
*/ */
#if ARDUINO < 100
#define HardwareSerial_h // trick to disable the standard HWserial #define HardwareSerial_h // trick to disable the standard HWserial
#if ARDUINO < 100
#include <WProgram.h> #include <WProgram.h>
#else // ARDUINO #else // ARDUINO
#include <Arduino.h> #include <Arduino.h>

View File

@ -24,13 +24,13 @@
* \brief SdBaseFile class * \brief SdBaseFile class
*/ */
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#if ARDUINO < 100
#define HardwareSerial_h // trick to disable the standard HWserial #define HardwareSerial_h // trick to disable the standard HWserial
#if ARDUINO < 100
#include <WProgram.h> #include <WProgram.h>
#include "MarlinSerial.h"
#else // ARDUINO #else // ARDUINO
#include <Arduino.h> #include <Arduino.h>
#endif // ARDUINO #endif // ARDUINO
#include "MarlinSerial.h"
#include "SdFatConfig.h" #include "SdFatConfig.h"
#include "SdVolume.h" #include "SdVolume.h"
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -24,13 +24,14 @@
* \brief Useful utility functions. * \brief Useful utility functions.
*/ */
#include <avr/pgmspace.h> #include <avr/pgmspace.h>
#if ARDUINO < 100
#define HardwareSerial_h // trick to disable the standard HWserial #define HardwareSerial_h // trick to disable the standard HWserial
#if ARDUINO < 100
#include <WProgram.h> #include <WProgram.h>
#include "MarlinSerial.h"
#else // ARDUINO #else // ARDUINO
#include <Arduino.h> #include <Arduino.h>
#endif // ARDUINO #endif // ARDUINO
#include "MarlinSerial.h"
/** Store and print a string in flash memory.*/ /** Store and print a string in flash memory.*/
#define PgmPrint(x) SerialPrint_P(PSTR(x)) #define PgmPrint(x) SerialPrint_P(PSTR(x))
/** Store and print a string in flash memory followed by a CR/LF.*/ /** Store and print a string in flash memory followed by a CR/LF.*/

View File

@ -51,7 +51,12 @@ int16_t SdFile::write(const void* buf, uint16_t nbyte) {
* \param[in] b the byte to be written. * \param[in] b the byte to be written.
* Use writeError to check for errors. * Use 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
{
SdBaseFile::write(&b, 1); SdBaseFile::write(&b, 1);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------

View File

@ -34,7 +34,12 @@ class SdFile : public SdBaseFile, public Print {
public: public:
SdFile() {} SdFile() {}
SdFile(const char* name, uint8_t oflag); SdFile(const char* name, uint8_t oflag);
void write(uint8_t b); #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); int16_t write(const void* buf, uint16_t nbyte);
void write(const char* str); void write(const char* str);
void write_P(PGM_P str); void write_P(PGM_P str);

View File

@ -101,7 +101,11 @@ extern uint8_t active_extruder;
/////semi-private stuff /////semi-private stuff
#include <WProgram.h> #if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
extern block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instfructions extern block_t block_buffer[BLOCK_BUFFER_SIZE]; // A ring buffer for motion instfructions
extern volatile unsigned char block_buffer_head; // Index of the next block to be pushed extern volatile unsigned char block_buffer_head; // Index of the next block to be pushed