In the same category as NeoHWSerial, I have modified PaulS's excellent AltSoftSerial library to support interrupt-driven character processing. As stated in the previous thread, I have seen occasional questions about handling received characters with interrupts, and many GPS users have been stymied by serial libraries only providing polled reading/events
I started with the source code for AltSerial and made the minimal modifications to implement 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 the NeoGPS example to use this class to handle GPS characters as they are received.
Cheers,
/dev