skywodd / pcf8574_arduino_library

PCF8574 / PCF8575 Arduino library (version 2.0)
88 stars 56 forks source link

not work with #include <SoftwareSerial.h> #8

Closed baselunarealpha closed 7 years ago

baselunarealpha commented 7 years ago

PCF8575 library does not compile with the SoftwareSerial.h

for example:

include

include

include

void setup() { // put your setup code here, to run once:

}

void loop() { // put your main code here, to run repeatedly:

}

It causes the following errors

SoftwareSerial.cpp:227: multiple definition of __vector_3' PCF8575\PCF8575.cpp PCF8575/PCint.h:104: first defined here SoftwareSerial\SoftwareSerial.cpp.o: In functionSoftwareSerial::read()': SoftwareSerial.cpp:392: multiple definition of __vector_4' PCF8575\PCF8575.cpp.o PCF8575/PCint.h:73: first defined here SoftwareSerial\SoftwareSerial.cpp.o: In functionSoftwareSerial::read()': SoftwareSerial.cpp:392: multiple definition of `__vector_5' PCF8575\PCF8575.cpp.o PCF8575/PCint.h:73: first defined here collect2.exe: error: ld returned 1 exit status

skywodd commented 7 years ago

The SoftwareSerial library use PC interrupts to handle pin state changes. The PCF857x library also use PC interrupts to handle for the pretty same reason. No compatibility possible here, sorry.

You can comment this line in the PCF8575.h to completely disable interrupts support :

#define PCF8575_INTERRUPT_SUPPORT

... or use the hardware serial directly. It's the only two options available.