Boo0ns / arduino

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

modification of wiring.c to use register #ifdefs instead of cpu #ifdefs #324

Closed GoogleCodeExporter closed 9 years ago

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

Change the ifdefs to be register based instead of cpu based

Why?

make it easier to support new cpus

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

No, it has been tested with all the standard cpu variations.

Original issue reported on code.google.com by mark.l.s...@gmail.com on 13 Aug 2010 at 6:26

Attachments:

GoogleCodeExporter commented 9 years ago
The changes to delay(..) function is not good for me, it seems that we lose the 
microsecond precision, a call like delay(5) could give a 5.001ms or 5.999ms 
delay with the same probability (in average you get a 5.500ms delay with a 10% 
skew).
Am I wrong?

old one:

void delay(unsigned long ms) {
  uint16_t start = (uint16_t)micros();
  while (ms > 0) {
    if (((uint16_t)micros() - start) >= 1000) {
      ms--;
      start += 1000;
    }
  }
}

mspr proposal:

void delay(unsigned long ms) {
  unsigned long start = millis();
  while (millis() - start <= ms)
    ;
}

Original comment by c.mag...@bug.st on 5 Oct 2010 at 6:20

GoogleCodeExporter commented 9 years ago
I don't think that's an intentional change.  Rather Mark probably grabbed 
wiring.c before the delay() function was updated to be more accurate.  You 
should probably diff against a previous version of wiring.c, or maybe Mark can 
submit a patch?

Original comment by dmel...@gmail.com on 5 Oct 2010 at 6:33

GoogleCodeExporter commented 9 years ago
I have to go through all of my updates and apply them to the latest (0021) 
code. I will pay attention to these comments and make sure I do not change the 
function or timing of the code.

Mark

Original comment by mark.l.s...@gmail.com on 5 Oct 2010 at 6:36

GoogleCodeExporter commented 9 years ago
Mark I've already seen all your patches belonging to issues:

http://code.google.com/p/arduino/issues/detail?id=340
http://code.google.com/p/arduino/issues/detail?id=324
http://code.google.com/p/arduino/issues/detail?id=343
http://code.google.com/p/arduino/issues/detail?id=316
http://code.google.com/p/arduino/issues/detail?id=315
http://code.google.com/p/arduino/issues/detail?id=307

and applied in this github branch:

merged your github tree -
http://github.com/cmaglie/Arduino/commit/5fa0b4415e9f4dc5d899bad0da89ad6b48ec76a
8

applied remaining patches -
http://github.com/cmaglie/Arduino/commit/c5b85b328eab35382aedbb0529099473bd70ab0
5

I changed a little bit your source code formatting, to reduce diffs size.
Can you check if I missed something?

tnx
C.

Original comment by c.mag...@bug.st on 5 Oct 2010 at 6:52

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

Original comment by dmel...@gmail.com on 17 Oct 2010 at 9:59