Go Down

Topic: Enableinterrupts and NeoSWSerial incompatable (Read 868 times) previous topic - next topic

Jorgie

Jun 30, 2019, 09:03 am Last Edit: Jun 30, 2019, 09:09 am by Jorgie
Out of the box EnableInterrups and NeoSWSerial are incompatible. This simple program results in errors when linking:

Code: [Select]

#include <EnableInterrupt.h>

#include <NeoSWSerial.h>

#define RX_PIN 3

NeoSWSerial myDevice (2,3);
void myDeviceISR()
{
  NeoSWSerial::rxISR( *portInputRegister( digitalPinToPort( RX_PIN ) ) );
  // if you know the exact PIN register, you could do this:
  //    NeoSWSerial::rxISR( PIND );
}

void setup()
{
  myDevice.begin( 9600 );
  enableInterrupt( RX_PIN, myDeviceISR, CHANGE );
 // enableInterrupt( OTHER_PIN, otherISR, RISING );
}
void loop()
{
 
}


If you compile this code the following errors will occur:
Code: [Select]
C:\Users\sean\AppData\Local\Temp\arduino_build_753120\libraries\NeoSWSerial\NeoSWSerial.cpp.o (symbol from plugin): In function `NeoSWSerial::read()':

(.text+0x0): multiple definition of `__vector_3'

C:\Users\sean\AppData\Local\Temp\arduino_build_753120\sketch\sketch_jun30a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

C:\Users\sean\AppData\Local\Temp\arduino_build_753120\libraries\NeoSWSerial\NeoSWSerial.cpp.o (symbol from plugin): In function `NeoSWSerial::read()':

(.text+0x0): multiple definition of `__vector_4'

C:\Users\sean\AppData\Local\Temp\arduino_build_753120\sketch\sketch_jun30a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

C:\Users\sean\AppData\Local\Temp\arduino_build_753120\libraries\NeoSWSerial\NeoSWSerial.cpp.o (symbol from plugin): In function `NeoSWSerial::read()':

(.text+0x0): multiple definition of `__vector_5'

C:\Users\sean\AppData\Local\Temp\arduino_build_753120\sketch\sketch_jun30a.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

collect2.exe: error: ld returned 1 exit status


It should not be necessary to edit NeoSWSerial.h in order to make this simple program compile and link.

Please consider adding the appropriate code to enable PinChange interrupts

 



westfw

Who is it that you suppose would do this, given that NewSWSerial and EnableInterrupts are both 3rd-party libraries (not from Arduino itself), written by different programmers?

Jorgie

The last line of my original post is making the suggestion:
Quote
Please consider adding the appropriate code to enable PinChange interrupts
I am asking for the PinChange interrupt capability to be added. This would stop 2 3rd party libraries from having to implement their own version and thus remove the incompatibility.

Go Up