diff options
Diffstat (limited to 'cores/arduino/HardwareSerial.h')
-rw-r--r-- | cores/arduino/HardwareSerial.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cores/arduino/HardwareSerial.h b/cores/arduino/HardwareSerial.h index 07445a0..8f00d15 100644 --- a/cores/arduino/HardwareSerial.h +++ b/cores/arduino/HardwareSerial.h @@ -45,6 +45,7 @@ class HardwareSerial : public Stream uint8_t _rxcie; uint8_t _udrie; uint8_t _u2x; + bool transmitting; public: HardwareSerial(ring_buffer *rx_buffer, ring_buffer *tx_buffer, volatile uint8_t *ubrrh, volatile uint8_t *ubrrl, @@ -59,6 +60,10 @@ class HardwareSerial : public Stream virtual int read(void); virtual void flush(void); virtual size_t write(uint8_t); + inline size_t write(unsigned long n) { return write((uint8_t)n); } + inline size_t write(long n) { return write((uint8_t)n); } + inline size_t write(unsigned int n) { return write((uint8_t)n); } + inline size_t write(int n) { return write((uint8_t)n); } using Print::write; // pull in write(str) and write(buf, size) from Print operator bool(); }; @@ -129,6 +134,22 @@ class HardwareSerial : public Stream extern HardwareSerial Serial3; #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)); #endif |