Skip to content

Commit 803593d

Browse files
author
Mark Sproul
committed
Changes to use register #ifdefs instead of cpu #ifdefs
1 parent 9c9e408 commit 803593d

File tree

8 files changed

+846
-450
lines changed

8 files changed

+846
-450
lines changed

hardware/arduino/cores/arduino/HardwareSerial.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
//* Aug 31, 2010 <MLS> The ATmega32U4 has uart1 but NOT uart0
2929
//* Sep 5, 2010 <MLS> V0019 was released, migrated changes into 0019
3030
//* Sep 28, 2010 <MLS> V0020 was released, migrated changes into 0020
31+
//* Oct 1, 2010 <MLS> Added more constraints to handle atmega128rfa1
3132
//*******************************************************************************************
3233

3334
#include <stdlib.h>
@@ -170,7 +171,7 @@ SIGNAL(USART1_RX_vect)
170171

171172

172173
//#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
173-
#if defined(USART2_RX_vect)
174+
#if defined(USART2_RX_vect) && defined(UDR2)
174175
//*******************************************************************************************
175176
SIGNAL(USART2_RX_vect)
176177
{
@@ -181,7 +182,7 @@ SIGNAL(USART2_RX_vect)
181182
#error SIG_USART2_RECV
182183
#endif
183184

184-
#if defined(USART3_RX_vect)
185+
#if defined(USART3_RX_vect) && defined(UDR3)
185186
//*******************************************************************************************
186187
SIGNAL(USART3_RX_vect)
187188
{

hardware/arduino/cores/arduino/Print.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@
1818
1919
Modified 23 November 2006 by David A. Mellis
2020
*/
21+
//************************************************************************
22+
//* Sep 28, 2010 <MLS> V0020 was released, migrated changes into 0020
23+
//* Oct 5, 2010 <MLS> V0020 was released, migrated changes into 0021
24+
//************************************************************************
2125

2226
#include <stdlib.h>
2327
#include <stdio.h>
@@ -218,3 +222,28 @@ void Print::printFloat(double number, uint8_t digits)
218222
remainder -= toPrint;
219223
}
220224
}
225+
226+
227+
//************************************************************************
228+
void Print::print_P(prog_char *flashMemStr)
229+
{
230+
char theChar;
231+
int ii;
232+
233+
ii = 0;
234+
#if (FLASHEND > 0x10000)
235+
while (theChar = pgm_read_byte_far(flashMemStr + ii++))
236+
#else
237+
while (theChar = pgm_read_byte_near(flashMemStr + ii++))
238+
#endif
239+
{
240+
print(theChar);
241+
}
242+
}
243+
244+
//************************************************************************
245+
void Print::println_P(prog_char *flashMemStr)
246+
{
247+
print_P(flashMemStr);
248+
println();
249+
}

hardware/arduino/cores/arduino/Print.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,25 @@
1616
License along with this library; if not, write to the Free Software
1717
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
1818
*/
19+
//************************************************************************
20+
//* Sep 28, 2010 <MLS> V0020 was released, migrated changes into 0020
21+
//* Oct 5, 2010 <MLS> V0020 was released, migrated changes into 0021
22+
//************************************************************************
1923

2024
#ifndef Print_h
2125
#define Print_h
2226

2327
#include <inttypes.h>
2428
#include <stdio.h> // for size_t
2529

30+
#include <avr/pgmspace.h>
31+
32+
2633
#include "WString.h"
2734

35+
#undef BIN
36+
37+
2838
#define DEC 10
2939
#define HEX 16
3040
#define OCT 8
@@ -61,6 +71,10 @@ class Print
6171
void println(unsigned long, int = DEC);
6272
void println(double, int = 2);
6373
void println(void);
74+
75+
76+
void print_P(prog_char *flashMemStr);
77+
void println_P(prog_char *flashMemStr);
6478
};
6579

6680
#endif

0 commit comments

Comments
 (0)