Pages: [1]   Go Down
Author Topic: SoftwareSerial and Arduino Leonardo Mega32u4  (Read 2856 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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) - smiley-cool : ((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!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Germany
Offline Offline
Full Member
***
Karma: 10
Posts: 230
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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) - smiley-cool : ((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.
Logged

Pages: [1]   Go Up
Jump to: