diff options
author | Matthijs Kooijman <matthijs@stdin.nl> | 2013-04-18 11:38:13 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2014-01-16 16:59:06 +0100 |
commit | 80d6af62730f11f9f23ec7a14d69bc6cfa01dd03 (patch) | |
tree | ce95365a73852a5f0ee7030e7276c977a7dcfc44 /libraries | |
parent | 3babfc2a855e49c5781f433fb5bd1227c8161dd8 (diff) |
Move interrupt handlers into HardwareSerial class
The actual interrupt vectors are of course defined as before, but they
let new methods in the HardwareSerial class do the actual work. This
greatly reduces code duplication and prepares for one of my next commits
which requires the tx interrupt handler to be called from another
context as well.
The actual content of the interrupts handlers was pretty much identical,
so that remains unchanged (except that store_char was now only needed
once, so it was inlined).
Now all access to the buffers are inside the HardwareSerial class, the
buffer variables can be made private.
One would expect a program size reduction from this change (at least
with multiple UARTs), but due to the fact that the interrupt handlers
now only have indirect access to a few registers (which previously were
just hardcoded in the handlers) and because there is some extra function
call overhead, the code size on the uno actually increases by around
70 bytes. On the mega, which has four UARTs, the code size decreases by
around 70 bytes.
Diffstat (limited to 'libraries')
0 files changed, 0 insertions, 0 deletions