Go Down

Topic: SoftwareSerial and Arduino Leonardo Mega32u4 (Read 3108 times) previous topic - next topic

normaldotcom

Hey, not sure how much help I can get for a technically unreleased product, but I'm using the Arduino 1.0 (final) IDE with a Leonardo clone. I'm trying to use the SoftwareSerial library, but it looks like it can't get information about the interrupt registers when compiling:

SoftwareSerial.cpp: In member function 'void SoftwareSerial::begin(long int)':
SoftwareSerial.cpp:396: error: 'digitalPinToPCICR' was not declared in this scope
SoftwareSerial.cpp:398: error: 'digitalPinToPCICRbit' was not declared in this scope
SoftwareSerial.cpp:399: error: 'digitalPinToPCMSK' was not declared in this scope
SoftwareSerial.cpp:399: error: 'digitalPinToPCMSKbit' was not declared in this scope
SoftwareSerial.cpp: In member function 'void SoftwareSerial::end()':
SoftwareSerial.cpp:414: error: 'digitalPinToPCMSK' was not declared in this scope
SoftwareSerial.cpp:415: error: 'digitalPinToPCMSKbit' was not declared in this scope

These macros are defined for the standard board in pins_arduino.h, but not for the Leonardo header file:

#define digitalPinToPCICR(p)    (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0))
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 2 : (((p) <= 13) ? 0 : 1))
#define digitalPinToPCMSK(p)    (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0))))
#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 13) ? ((p) - 8) : ((p) - 14)))

Can anyone provide some insight as to the function of these compiler macros? I have lower-level experience with AVR/PIC platforms, but I'm not exactly sure what these macros do. I'm assuming the m32u4 won't need many significant changes from the m328, but I'm not positive of that (time to read some datasheets...). Thanks for your help!

normaldotcom

Found a bug filed regarding this issue: http://code.google.com/p/arduino/issues/detail?id=714

On second glance, the macros seem pretty simple. If I get around to writing them for the m32u4, I'll post a patch.

Markus_L811


Hey, not sure how much help I can get for a technically unreleased product, but I'm using the Arduino 1.0 (final) IDE with a Leonardo clone. I'm trying to use the SoftwareSerial library, but it looks like it can't get information about the interrupt registers when compiling:

SoftwareSerial.cpp: In member function 'void SoftwareSerial::begin(long int)':
SoftwareSerial.cpp:396: error: 'digitalPinToPCICR' was not declared in this scope
SoftwareSerial.cpp:398: error: 'digitalPinToPCICRbit' was not declared in this scope
SoftwareSerial.cpp:399: error: 'digitalPinToPCMSK' was not declared in this scope
SoftwareSerial.cpp:399: error: 'digitalPinToPCMSKbit' was not declared in this scope
SoftwareSerial.cpp: In member function 'void SoftwareSerial::end()':
SoftwareSerial.cpp:414: error: 'digitalPinToPCMSK' was not declared in this scope
SoftwareSerial.cpp:415: error: 'digitalPinToPCMSKbit' was not declared in this scope

These macros are defined for the standard board in pins_arduino.h, but not for the Leonardo header file:

#define digitalPinToPCICR(p)    (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0))
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 2 : (((p) <= 13) ? 0 : 1))
#define digitalPinToPCMSK(p)    (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0))))
#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 13) ? ((p) - 8) : ((p) - 14)))

Can anyone provide some insight as to the function of these compiler macros? I have lower-level experience with AVR/PIC platforms, but I'm not exactly sure what these macros do. I'm assuming the m32u4 won't need many significant changes from the m328, but I'm not positive of that (time to read some datasheets...). Thanks for your help!


Hi,

I did this btw. for the external interrupts look there.

http://arduino.cc/forum/index.php/topic,96202.msg722362.html#msg722362

B.R.

Go Up