SWseriale simple software serial library

Arduino models equipped with Atmel ATmega328P microcontroller unfortunately have only 1 hardware serial port available.
For this reason, I decided to create a "high efficiency, low CPU load" software serial library which uses Pin 3 (RX) and Pin 4 (TX), in order to manage an additional serial port.
The library uses an external interrupt (INT1) on Pin 3, in order to catch the "start bit" transition (from 5V to 0V), plus an 8 bit timer (Timer2) in order to create the timing for reading and writing information bits on the serial bus.
Since this library only has few instruction codes (less than 250 C code lines), it is lighter than the usual Arduino Software Serial library.
The transmission is managed using interrupts (with few microseconds execution time) at each bit timing, so the calculation load of the CPU is very small, and also the main program execution is not locked during sending and transmission operations.
Both sending and receiving operations use Timer2 for the bit timing: it is not possible to send and receive at the same time. Therefore, the communication can be only half-duplex.

How to use the library to send and receive data:

  1. Include "SWseriale.h" to your program (#include "SWseriale.h")
  2. Include function call "SWseriale.begin()" into the Setup() function of Arduino sketch
  3. Read serial data using functions "SWseriale.available()" and "SWseriale.read()"
  4. Send serial data using function "SWseriale.write()"

The library is available on GitHub, on my page (dadez87): GitHub - dadez87/SWseriale: Software serial library for Arduino (Atmel ATmega328 microcontroller). The serial communication works at 9600 baud using PIN 3 (RX) and PIN 4 (TX). These pins can be changed. In its standard configuration, it makes use of INT1 interrupt and Timer2 8 bit timer.

"Arduino models equipped with Atmel ATmega328P microcontroller unfortunately have only 1 hardware serial port available. "
"Both sending and receiving operations use Timer2 for the bit timing: it is not possible to send and receive at the same time. Therefore, the communication can be only half-duplex."

What do some of the other software serial libraries do for comparison? Software Serial, NewSoft Seria, Neosoft serial AltSoft serial, names like those.

I prefer the '1284P for its dual hardware serial -> faster speeds, and full duplex.