laesaster / arduino

Automatically exported from code.google.com/p/arduino
0 stars 0 forks source link

Update to HardwareSerial.cpp to use register #ifdefs #315

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What change would like to see?

This is a new version of HarwareSerial.cpp and HardwareSerial.h

No code has been changed but the #ifdefs have been changed to use register and 
signal definitions instead of cpu defines. This will make it much easier to 
port to new CPUs

Why?

To make it easier to introduce new cpus

Would this cause any incompatibilities with previous versions?  If so, how
can these be mitigated?

No issues, no code has been changed

Original issue reported on code.google.com by mark.l.s...@gmail.com on 3 Aug 2010 at 5:59

GoogleCodeExporter commented 9 years ago
Correction, the source has NOT been changed, only the ifdefs

Original comment by mark.l.s...@gmail.com on 3 Aug 2010 at 7:02

GoogleCodeExporter commented 9 years ago
Did some more testing, here is a new version

Original comment by mark.l.s...@gmail.com on 3 Aug 2010 at 7:30

Attachments:

GoogleCodeExporter commented 9 years ago
Looks reasonable.  It's easier for me to deal with patches (preferably with 
minimal changes to the original source), but if it's an issue, I can diff the 
files myself.  This isn't necessarily a top priority at the moment, but I would 
like to get it in if I can.

Original comment by dmel...@gmail.com on 3 Aug 2010 at 9:16

GoogleCodeExporter commented 9 years ago
Found another combination in the atmega8535, required one minor change

Original comment by mark.l.s...@gmail.com on 29 Aug 2010 at 5:23

Attachments:

GoogleCodeExporter commented 9 years ago
http://github.com/arduino/Arduino/commit/1cb3c97610a0faf6f2c55e60e6fc440f4edb3b4
4

Original comment by dmel...@gmail.com on 17 Oct 2010 at 5:38

GoogleCodeExporter commented 9 years ago
This change broke some code that does
#include "HardwareSerial.h"
when they haven't done a previous include that defined the registers.

My particular example is arduino-debug.cpp from 
http://sites.google.com/site/ghoelzl/ipv6ethershield
There are other examples of HardwareSerial.h breakages in arduino-0022 reported 
in the forums e.g.
http://arduino.cc/forum/index.php/topic,51244.0.html

Suggested fix:
a) Add to HardwareSerial.h
   #include "wiring.h"
or
b) Since HarwareSerial.cpp #includes HardwareSerial.h
  you can move the #include "wiring.h"
  from HardwareSerial.cpp to HardwareSerial.h
  and move the #include "HardwareSerial.h" to before the #if defined(UBRH) ... 

Thanks,
    John

Original comment by john.a.m...@gmail.com on 14 Mar 2011 at 10:25