I have just published NeoSWSerial, a C++ library that is in the same category as NeoHWSerial and NeoICSerial. I have modified jboyton's excellent gSoftSerial library to support interrupt-driven character processing, and he has generously offered to let me support debug publish it.
As stated in the other threads, I have seen occasional questions about handling received characters with interrupts. Many GPS users have been stymied by serial libraries only providing polled reading/events, which frequently leads to input buffer overflow.
I extended his library to support multiple pins (not concurrently), multiple boards, and I also added an attachInterrupt
method, identical to the pre-existing [
attachInterrupt
](https://www.arduino.cc/en/Reference/AttachInterrupt) for digital Pin Change interrupts. Whenever a character is received, it calls the registered procedure from the ISR:
static void handleRxChar( uint8_t c )
{
gps.decode( c );
}
void setup()
{
serial_port.attachInterrupt( handleRxChar );
serial_port.begin( 9600 );
}
I have also updated NeoGPS to use this class, in all examples if the header is included, but especially in the NMEA_isr example to handle GPS characters as they are received. Be sure to see the github page for limitations and advantages.
Thanks are also due to Robin2 for original work in this thread, and to robtillart for helpful posts on a similar topic here.
Cheers,
/dev