diff options
author | Cristian Maglie <c.maglie@bug.st> | 2014-01-22 10:12:56 +0100 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2014-01-22 11:19:35 +0100 |
commit | 49fc2ab8ad43b86f7668da8d0186abe0d48cd6d9 (patch) | |
tree | e3323394bffeafbbaa3999bb1c5567a548ea7dc7 /cores/arduino/HardwareSerial.h | |
parent | 1848db3d66e232b10d7e701063f1238809cf6a53 (diff) |
Inlined HardwareSerial calls to RX ISR.
Moreover, declaring pointers-to-registers as const and using initializer
list in class constructor allows the compiler to further improve inlining
performance.
This change recovers about 50 bytes of program space on single-UART devices.
See #1711
Diffstat (limited to 'cores/arduino/HardwareSerial.h')
-rw-r--r-- | cores/arduino/HardwareSerial.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/cores/arduino/HardwareSerial.h b/cores/arduino/HardwareSerial.h index da9efbc..bd3c4c4 100644 --- a/cores/arduino/HardwareSerial.h +++ b/cores/arduino/HardwareSerial.h @@ -66,12 +66,12 @@ class HardwareSerial : public Stream { protected: - volatile uint8_t *_ubrrh; - volatile uint8_t *_ubrrl; - volatile uint8_t *_ucsra; - volatile uint8_t *_ucsrb; - volatile uint8_t *_ucsrc; - volatile uint8_t *_udr; + volatile uint8_t * const _ubrrh; + volatile uint8_t * const _ubrrl; + volatile uint8_t * const _ucsra; + volatile uint8_t * const _ucsrb; + volatile uint8_t * const _ucsrc; + volatile uint8_t * const _udr; // Has any byte been written to the UART since begin() bool _written; @@ -87,7 +87,7 @@ class HardwareSerial : public Stream unsigned char _tx_buffer[SERIAL_BUFFER_SIZE]; public: - HardwareSerial( + inline HardwareSerial( volatile uint8_t *ubrrh, volatile uint8_t *ubrrl, volatile uint8_t *ucsra, volatile uint8_t *ucsrb, volatile uint8_t *ucsrc, volatile uint8_t *udr); @@ -107,7 +107,7 @@ class HardwareSerial : public Stream operator bool() { return true; } // Interrupt handlers - Not intended to be called externally - void _rx_complete_irq(void); + inline void _rx_complete_irq(void); void _tx_udr_empty_irq(void); }; |