SlashDevin / NeoSWSerial

Efficient alternative to SoftwareSerial with attachInterrupt for RX chars, simultaneous RX & TX
173 stars 42 forks source link

Add inverse_logic capability as per SoftwareSerial. #7

Open Matthew-Marks opened 7 years ago

Matthew-Marks commented 7 years ago

I had to add this functionality for the hardware I have, and it seems to work on that. I have not tested it in non-inverse mode!

SlashDevin commented 7 years ago

Thanks for adding a feature!

Have you tried all three baud rates? The changes should have minimal impact on the timing, but you should probably use a second Arduino to try both inverse & normal modes and all 3 baud rates.

If you don't have one, there's a test program (for a Mega) in the test subdirectory. It tries a few different things (all character values, RX only, TX only, TX then RX, RX then TX), with Serial3 connected to the NeoSWSerial port. There is a certain amount of synchronization with this kind of test, so it's not the best. A second Arduino (fully asynchronous) is the only way to catch some timing issues.

Thanks again.

Matthew-Marks commented 7 years ago

You're welcome. I tested on a 328 with 19200. No spare serial ports, but I also have a 168 board (should be compatible with the 328) so I'll add that to the same #define and connect them together.

sandervandegeijn commented 7 years ago

Would like to have this feature as well.

SlashDevin commented 7 years ago

I'm concerned about the timing impact at 38400. If it adds too many cycles, the inverse option may have to be selected at compile-time, not passed in as a run-time argument. Sorry I don't have time to test it. @neographikal, is it something you could test?