I have 2 different devices on Serial1. I use a multiplexor to switch between the two devices.
One runs at baud 9600 and the other at 115200. What is the correct way to switch between these two devices.
Is flush required?
Is Serial1.end() required?
Thanks
That should work.
On some ports on RTL872x devices you may also need to add a short delay, because flush writes out the output buffer, but there's a second byte FIFO that still needs to be output. It only applies to one of the alternate ports, not the regular Serial1, if I recall correctly.
Though I would use a SC16IS7xx SPI or I2C UART instead of using a multiplexer. The SC16IS752 dual port works great with all Particle devices using the SC16IS7xxRK library. I'd use SPI mode for 115200.