Moving TXCO definition into HardwareSerial.cpp from HardwareSerial.h.
Otherwise, you get an error when compiling for processors with no serial port because the header file is always compiled. See, for an example of the problem: https://github.com/damellis/attiny/issues/8
This commit is contained in:
parent
c8f3857fe5
commit
ccedc84eb2
|
@ -34,6 +34,22 @@
|
||||||
|
|
||||||
#include "HardwareSerial.h"
|
#include "HardwareSerial.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* on ATmega8, the uart and its bits are not numbered, so there is no "TXC0"
|
||||||
|
* definition. It is slightly cleaner to define this here instead of having
|
||||||
|
* conditional code in the cpp module.
|
||||||
|
*/
|
||||||
|
#if !defined(TXC0)
|
||||||
|
#if defined(TXC)
|
||||||
|
#define TXC0 TXC
|
||||||
|
#elif defined(TXC1)
|
||||||
|
// Some devices have uart1 but no uart0
|
||||||
|
#define TXC0 TXC1
|
||||||
|
#else
|
||||||
|
#error TXC0 not definable in HardwareSerial.h
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// Define constants and variables for buffering incoming serial data. We're
|
// Define constants and variables for buffering incoming serial data. We're
|
||||||
// using a ring buffer (I think), in which head is the index of the location
|
// using a ring buffer (I think), in which head is the index of the location
|
||||||
// to which to write the next incoming character and tail is the index of the
|
// to which to write the next incoming character and tail is the index of the
|
||||||
|
|
|
@ -110,22 +110,6 @@ class HardwareSerial : public Stream
|
||||||
extern HardwareSerial Serial3;
|
extern HardwareSerial Serial3;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
|
||||||
* on ATmega8, the uart and its bits are not numbered, so there is no "TXC0"
|
|
||||||
* definition. It is slightly cleaner to define this here instead of having
|
|
||||||
* conditional code in the cpp module.
|
|
||||||
*/
|
|
||||||
#if !defined(TXC0)
|
|
||||||
#if defined(TXC)
|
|
||||||
#define TXC0 TXC
|
|
||||||
#elif defined(TXC1)
|
|
||||||
// Some devices have uart1 but no uart0
|
|
||||||
#define TXC0 TXC1
|
|
||||||
#else
|
|
||||||
#error TXC0 not definable in HardwareSerial.h
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern void serialEventRun(void) __attribute__((weak));
|
extern void serialEventRun(void) __attribute__((weak));
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue