Broken pins_arduino.h prevents including SoftwareSerial.h

I'm using the Lilypad Protosnap Plus setup and trying to load a super simple sketch:

#include <SoftwareSerial.h> //All I'm doing is including this header file

void setup() {
  //Setup nothing
}

void loop() {
  //Loop nothing
}

This results in the following error:

In file included from /Applications/Arduino.app/Contents/Java/hardware/tools/avr/avr/include/avr/io.h:99:0,
                 from /Applications/Arduino.app/Contents/Java/hardware/tools/avr/avr/include/avr/interrupt.h:38,
                 from /Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial/src/SoftwareSerial.cpp:41:
/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial/src/SoftwareSerial.cpp: In member function 'void SoftwareSerial::begin(long int)':
/Users/x/Library/Arduino15/packages/SparkFun/hardware/avr/1.1.8/variants/lilypadusbplus/pins_arduino.h:159:219: error: expected ':' before ')' token
 #define digitalPinToPCMSKbit(p) ( ((p) == 1) ? 0 : ((p) == 21) ? 1 : ((p) == 22) ? 2 : ((p) == 23) ? 3 : ((p) == 6) ? 7 : (((p) == 4)||((p) == A4)) ? 4 : (((p) == 8)||((p) == A8)) ? 5 : (((p) == 12)||((p) == A10)) ? 6 )

                                                                                                                                                                                                                           ^
/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial/src/SoftwareSerial.cpp:364:28: note: in expansion of macro 'digitalPinToPCMSKbit'
     _pcint_maskvalue = _BV(digitalPinToPCMSKbit(_receivePin));

                            ^
/Users/x/Library/Arduino15/packages/SparkFun/hardware/avr/1.1.8/variants/lilypadusbplus/pins_arduino.h:159:219: error: expected primary-expression before ')' token
 #define digitalPinToPCMSKbit(p) ( ((p) == 1) ? 0 : ((p) == 21) ? 1 : ((p) == 22) ? 2 : ((p) == 23) ? 3 : ((p) == 6) ? 7 : (((p) == 4)||((p) == A4)) ? 4 : (((p) == 8)||((p) == A8)) ? 5 : (((p) == 12)||((p) == A10)) ? 6 )

                                                                                                                                                                                                                           ^
/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial/src/SoftwareSerial.cpp:364:28: note: in expansion of macro 'digitalPinToPCMSKbit'
     _pcint_maskvalue = _BV(digitalPinToPCMSKbit(_receivePin));

                            ^
exit status 1
Error compiling for board LilyPad USB Plus.

Basically, in the file pins_arduino.h (provided by Sparkfun) and line 159, the final nested ternary operator is missing a colon and an else operation:

(((p) == 12)||((p) == A10)) ? 6 // missing something like ":11"

I am new to Arduino's and can't rationalize what the else operation might be...

The relevant pins_arduino.h header file can be found here:

Any help or suggestions would be greatly appreciated!

Also posted at:

If you're going to do that then please be considerate enough to add links to the other places you cross posted. This will let us avoid wasting time due to duplicate effort and also help others who have the same questions and find your post to discover all the relevant information. When you post links please always use the chain links icon on the toolbar to make them clickable.

The value assigned to the final else clause is not really important since it's what's returned if a pin number that doesn't PCMSK0 is passed to the macro. It's not clear to me what the most appropriate value would be but I'm going to suggest -1:

#define digitalPinToPCMSKbit(p) ( ((p) == 1) ? 0 : ((p) == 21) ? 1 : ((p) == 22) ? 2 : ((p) == 23) ? 3 : ((p) == 6) ? 7 : (((p) == 4)||((p) == A4)) ? 4 : (((p) == 8)||((p) == A8)) ? 5 : (((p) == 12)||((p) == A10)) ? 6 : -1 )

Who broke the file pins_arduino.h? Why not just get an un-broken version.

If it is the fault of Sparkfun why not ask them to fix it?

...R

pert:
The value assigned to the final else clause is not really important since it's what's returned if a pin number that doesn't PCMSK0 is passed to the macro. It's not clear to me what the most appropriate value would be but I'm going to suggest -1:

#define digitalPinToPCMSKbit(p) ( ((p) == 1) ? 0 : ((p) == 21) ? 1 : ((p) == 22) ? 2 : ((p) == 23) ? 3 : ((p) == 6) ? 7 : (((p) == 4)||((p) == A4)) ? 4 : (((p) == 8)||((p) == A8)) ? 5 : (((p) == 12)||((p) == A10)) ? 6 : -1 )

I tried setting this to -1 as suggested and, while it compiled, I can't seem to receive data via my Xbee setup.

Basically, I have two Protosnap Plus boards (lilypad) each attached to an Xbee. I can confirm that the Xbees are configured correctly via XCTU and, also, they are able to communicate when connected to an Arduino Uno. However, when connected to the Protosnap Plus Lilypad, SoftwareSerial.h references a custom pins_arduino.h that is provided by SparkFun (see above).

Right now, I am able to send a message from Lilypad+Xbee #1 to Lilypad+Xbee #2 but I cannot receive via Lilypad+Xbee #1. I've even tried all combinations of numbers from 0-18 (instead of -1 as suggested) but without any luck.

#include <SoftwareSerial.h>
// XBee's DOUT (TX) is connected to pin 10 (Arduino's Software RX)
// XBee's DIN (RX) is connected to pin 11 (Arduino's Software TX)
SoftwareSerial XBee(10, 11); // RX, TX

void setup()
{
  // Set up both ports at 9600 baud. This value is most important
  // for the XBee. Make sure the baud rate matches the config
  // setting of your XBee.
  XBee.begin(9600);
  Serial.begin(9600);  
}

void loop()
{

  if (Serial.available())
  { // If data comes in from serial monitor, send it out to XBee
    XBee.write(Serial.read());
  }
  if (XBee.available())
  { // If data comes in from XBee, send it out to serial monitor
    Serial.write(XBee.read());
  }
}