prampec / arduino-pcimanager

Manage the Pin Change Interrupt in Arduino.
17 stars 11 forks source link

Conflict between Pcimanager & SoftwareSerial #3

Open timwilson235 opened 8 years ago

timwilson235 commented 8 years ago

I want to use SoftTimer and SoftwareSerial together. To use SoftTimer, I have to also include PciManager.h. But if I include both PciManager.h and SoftwareSerial.h, I get a stream of ld errors (sample below). I am using latest releases of SoftTimer & PciManager (3.1.0 and 2.1.0 respectively), and the SoftwareSerial that's built-in to Arduino IDE 1.6.5.

Compile output follows:

Arduino: 1.6.5 (Mac OS X), Board: "Arduino/Genuino Uno"

PciManager/PciManager.cpp.o: In function __vector_3': /Users/twilson/Documents/Arduino/libraries/PciManager/src/PciManager.cpp:144: multiple definition ofvector_3' SoftwareSerial/SoftwareSerial.cpp.o:/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp:227: first defined here PciManager/PciManager.cpp.o: In function PciManagerClass::remove(PciListener*)': /Users/twilson/Documents/Arduino/libraries/PciManager/src/PciManager.cpp:63: multiple definition of__vector_4' SoftwareSerial/SoftwareSerial.cpp.o:/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp:392: first defined here PciManager/PciManager.cpp.o: In function PciManagerClass::remove(PciListener*)': /Users/twilson/Documents/Arduino/libraries/PciManager/src/PciManager.cpp:63: multiple definition ofvector_5' SoftwareSerial/SoftwareSerial.cpp.o:/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp:392: first defined here collect2: error: ld returned 1 exit status Error compiling.

prampec commented 8 years ago

I confirm the problem. The SoftwareSerial occupies PinChangeInterrupt PCI vectors, so does the PciManager. This causes the conflict. As matter stand PciManager cannot be used in combination with SoftwareSerial. I need to consult with the authors of SoftwareSerial whether we can find a solution for that.

(It seems that I finally need to make it possible to use SoftTimer without PciManager, but thats an issue for the SoftTimer project.)

acacha commented 8 years ago

Same problem here!

prampec commented 8 years ago

Unfortunately I couldn't found a way to consult with the authors of SoftwareSerial. If one can help me in that I might do any further steps.

If you are about to use SoftTimer with SoftwareSerial, you can remove Debouncer and Rotary source files that needs PciManager, to remove dependency. If I find an origin of SoftwareSerial (which I could not), I might want to provide a patch, so that SoftwareSerial use PciManager instead direct PCI access.

Another solution is for you to use an older version of SoftwareSerial.

dedayoa commented 6 years ago

I just ran into this same issue. Is there a fix (in the wild) yet...or has anyone come up with a work around - besides removing debouncer and rotary.

prampec commented 6 years ago

I have forked (and keep managed) a version of the SoftTimer, that contains only the core functionality and no classes requires PCI. https://github.com/prampec/arduino-softtimer-nopci

(It still can be possible to migrate the SoftwareSerial source code to use PciManager so that other event handlers could also benefit from the PCI interrupts.)