Where in the source tree is the software 'bit-banging' serial implementation?

GitHub is used for so many different things that my Google searches get drowned out with documentation and high-level use cases. Can someone point me to the bit-banging code used for software serial in ESPHome?

My idea is to save a GPIO by combining TX and RX on a single pin in a half-duplex master/slave setup. Just like software I2C, the TX pin would have a pull-up and switch between input for ‘1’ and output low for ‘0’. The changes to TX should be trivial, but RX could get extra messy.

The Esp8266 have software serial in Esphome.

For ESP32 software serial would need to be included explicitly. See the ratgdo esphome project for an example.

For half duplex there was an example sketch.

Where is the saving if you still need TX and RX?

Thanks. I did get as far as that folder, but I didn’t look inside. To me, UART implies “hardware”. I was looking for something with “serial” in the name. We can’t change history, but I think it should have been named the “serial” component with hardware (UART) and software (bit-bang) implementations.

Yes, ratdgo is actually one of the target applications for my shared TX and RX idea. You should be able to use a simple level shifter instead of the 2 transistors and separate RX in the current design.

The Vista ECP alarm interface is the same game except you must drive the output high instead of low. There’s also the Vista V-Plex protocal that uses just 2 wires for power and data. I don’t think anyone has cracked that protocol yet.

In all of the above (and 2-wire RS-485), it’s physically impossible to both send and receive at the same time. Unless you’re using the hardware UART, you should only need 1 pin shared by TX and RX.

Most people are going to say it’s just 1 pin, why torture yourself? I’m looking at Sonoff devices (Basic and Mini) with limited access to I/O pins. The best solution would be custom hardware, but that would cost 10x as much (assembled unit with enclosure).

TX and RX would be the same pin.