Browse Source

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

Bernhard 13 years ago
parent
commit
0bc9daa4f7
8 changed files with 675 additions and 651 deletions
  1. 6
    1
      Marlin/Marlin.h
  2. 5
    1
      Marlin/MarlinSerial.cpp
  3. 642
    642
      Marlin/Sd2Card.cpp
  4. 2
    2
      Marlin/SdBaseFile.h
  5. 3
    2
      Marlin/SdFatUtil.h
  6. 6
    1
      Marlin/SdFile.cpp
  7. 6
    1
      Marlin/SdFile.h
  8. 5
    1
      Marlin/planner.h

+ 6
- 1
Marlin/Marlin.h View File

5
 // Licence: GPL
5
 // Licence: GPL
6
 #define  HardwareSerial_h // trick to disable the standard HWserial
6
 #define  HardwareSerial_h // trick to disable the standard HWserial
7
 #include <math.h>
7
 #include <math.h>
8
-#include <WProgram.h>
8
+#if ARDUINO >= 100
9
+  #include "Arduino.h"
10
+#else
11
+   #include "WProgram.h"
12
+#endif
13
+
9
 #include "fastio.h"
14
 #include "fastio.h"
10
 #include <avr/pgmspace.h>
15
 #include <avr/pgmspace.h>
11
 #include "Configuration.h"
16
 #include "Configuration.h"

+ 5
- 1
Marlin/MarlinSerial.cpp View File

25
 #include <string.h>
25
 #include <string.h>
26
 #include <inttypes.h>
26
 #include <inttypes.h>
27
 #include <math.h>
27
 #include <math.h>
28
-#include "wiring.h"
28
+#if ARDUINO >= 100
29
+  #include "Arduino.h"
30
+#else
31
+   #include "wiring.h"
32
+#endif
29
 #include "wiring_private.h"
33
 #include "wiring_private.h"
30
 
34
 
31
 // this next line disables the entire HardwareSerial.cpp, 
35
 // this next line disables the entire HardwareSerial.cpp, 

+ 642
- 642
Marlin/Sd2Card.cpp
File diff suppressed because it is too large
View File


+ 2
- 2
Marlin/SdBaseFile.h View File

24
  * \brief SdBaseFile class
24
  * \brief SdBaseFile class
25
  */
25
  */
26
 #include <avr/pgmspace.h>
26
 #include <avr/pgmspace.h>
27
-#if ARDUINO < 100
28
 #define  HardwareSerial_h // trick to disable the standard HWserial
27
 #define  HardwareSerial_h // trick to disable the standard HWserial
28
+#if ARDUINO < 100
29
 #include <WProgram.h>
29
 #include <WProgram.h>
30
-#include "MarlinSerial.h"
31
 #else  // ARDUINO
30
 #else  // ARDUINO
32
 #include <Arduino.h>
31
 #include <Arduino.h>
33
 #endif  // ARDUINO
32
 #endif  // ARDUINO
33
+#include "MarlinSerial.h"
34
 #include "SdFatConfig.h"
34
 #include "SdFatConfig.h"
35
 #include "SdVolume.h"
35
 #include "SdVolume.h"
36
 //------------------------------------------------------------------------------
36
 //------------------------------------------------------------------------------

+ 3
- 2
Marlin/SdFatUtil.h View File

24
  * \brief Useful utility functions.
24
  * \brief Useful utility functions.
25
  */
25
  */
26
 #include <avr/pgmspace.h>
26
 #include <avr/pgmspace.h>
27
-#if ARDUINO < 100
27
+
28
 #define  HardwareSerial_h // trick to disable the standard HWserial
28
 #define  HardwareSerial_h // trick to disable the standard HWserial
29
+#if ARDUINO < 100
29
 #include <WProgram.h>
30
 #include <WProgram.h>
30
-#include "MarlinSerial.h"
31
 #else  // ARDUINO
31
 #else  // ARDUINO
32
 #include <Arduino.h>
32
 #include <Arduino.h>
33
 #endif  // ARDUINO
33
 #endif  // ARDUINO
34
+#include "MarlinSerial.h"
34
 /** Store and print a string in flash memory.*/
35
 /** Store and print a string in flash memory.*/
35
 #define PgmPrint(x) SerialPrint_P(PSTR(x))
36
 #define PgmPrint(x) SerialPrint_P(PSTR(x))
36
 /** Store and print a string in flash memory followed by a CR/LF.*/
37
 /** Store and print a string in flash memory followed by a CR/LF.*/

+ 6
- 1
Marlin/SdFile.cpp View File

51
  * \param[in] b the byte to be written.
51
  * \param[in] b the byte to be written.
52
  * Use writeError to check for errors.
52
  * Use writeError to check for errors.
53
  */
53
  */
54
-void SdFile::write(uint8_t b) {
54
+#if ARDUINO >= 100
55
+  size_t SdFile::write(uint8_t b)
56
+#else
57
+  void SdFile::write(uint8_t b)
58
+#endif
59
+{
55
   SdBaseFile::write(&b, 1);
60
   SdBaseFile::write(&b, 1);
56
 }
61
 }
57
 //------------------------------------------------------------------------------
62
 //------------------------------------------------------------------------------

+ 6
- 1
Marlin/SdFile.h View File

34
  public:
34
  public:
35
   SdFile() {}
35
   SdFile() {}
36
   SdFile(const char* name, uint8_t oflag);
36
   SdFile(const char* name, uint8_t oflag);
37
-  void write(uint8_t b);
37
+  #if ARDUINO >= 100
38
+  size_t write(uint8_t b);
39
+#else
40
+   void write(uint8_t b);
41
+#endif
42
+  
38
   int16_t write(const void* buf, uint16_t nbyte);
43
   int16_t write(const void* buf, uint16_t nbyte);
39
   void write(const char* str);
44
   void write(const char* str);
40
   void write_P(PGM_P str);
45
   void write_P(PGM_P str);

+ 5
- 1
Marlin/planner.h View File

101
 
101
 
102
     
102
     
103
 /////semi-private stuff
103
 /////semi-private stuff
104
-#include <WProgram.h>
104
+#if ARDUINO >= 100
105
+  #include "Arduino.h"
106
+#else
107
+   #include "WProgram.h"
108
+#endif
105
 
109
 
106
 extern block_t block_buffer[BLOCK_BUFFER_SIZE];            // A ring buffer for motion instfructions
110
 extern block_t block_buffer[BLOCK_BUFFER_SIZE];            // A ring buffer for motion instfructions
107
 extern volatile unsigned char block_buffer_head;           // Index of the next block to be pushed
111
 extern volatile unsigned char block_buffer_head;           // Index of the next block to be pushed

Loading…
Cancel
Save