Is it just me, or does it break a lot of stuff that MBed 6’s serial port classes (BufferedSerial and UnbufferedSerial) no longer implement the Stream interface? Don’t get me wrong, I love that MODSERIAL-like buffering functionality is now integrated into the main OS. However, I have a huge amount of existing code that passes around multiple serial ports as Stream objects and writes to them with printf(), and this no longer works properly.
So, I wrote a quick little adapter class that lets you use a serial port as a Stream: https://os.mbed.com/users/MultipleMonomials/code/SerialStream/ . If anyone else out there has this same problem as me, hopefully this will be helpful.
If any MBed developers are reading this, would it be possible to get something like this integrated into the OS itself? Ideally the serial classes could implement Stream again, but I can understand why this likely isn’t going to happen since Stream adds some overhead due to its use of C file handles. Alternately, you could just add a wrapper class or subclass like this one. It’s really tiny, like 20 lines of code, and it restores a lot of compatibility that was broken in this update.