Description
Why is SoftwareSerial defining ISR for all possible PinChangeInterrupt vectors? Even if not all of them are used, the ISR is registered and prevents others (e.g. other libs) from registering PinChangeInterrupts.
For example. If you use SoftwareSerial on Digital Ports 2 and 3 (Arduino Uno/Nano), it is not possible to specify a PinchangeInterrupt for pin A1. (e.g. by using PinChangeInterrupt library).
Reason is, that SoftwareSerial registers on ISR for all ports. Why? Since SoftwareSerial is some kind of system library, to me this behavior seems wrong.
Wouldn't at least something like the following code snippet be useful? (Would prevent users from including their own hacked SoftwareSerial.cpp, missing new updates...)
(originally lines 227-244 in SoftwareSerial.cpp)
#if defined(PCINT0_vect)
ISR(PCINT0_vect)
{
SoftwareSerial::handle_interrupt();
}
#endif
#ifndef SOFTSERIAL_IGNORE_PCINT1
#if defined(PCINT1_vect)
ISR(PCINT1_vect, ISR_ALIASOF(PCINT0_vect));
#endif
#endif
#ifndef SOFTSERIAL_IGNORE_PCINT2
#if defined(PCINT2_vect)
ISR(PCINT2_vect, ISR_ALIASOF(PCINT0_vect));
#endif
#endif
##ifndef SOFTSERIAL_IGNORE_PCINT3
#if defined(PCINT3_vect)
ISR(PCINT3_vect, ISR_ALIASOF(PCINT0_vect));
#endif
#endif
This modification would leave all existing projects working, but gives future users the ability to ignore ISR creation if they don't need it explicitly.
Kind regards,
Martin