Asynchronous serial methods lost in mbed 6?


Deprecated class RawSerial has been replaced by class UnbufferedSerial in mbed 6. But many async methods provided by RawSerial (say: read with callback and char match, write with callback, abort read or write…) are private now, so cannot be used.

Is this deliberate? How can one now launch an async serial RX with char match?

Thanks & regards.

Nope, they actually added a better way to do this! They just forgot to document it. Hitchhiker's Guide to Printf in Mbed 6


Maybe you can extend your answer a bit. What is such better way? The link you posted does not seem to solve the problem I stated. On it you say that, to communicate with external devices (GPS in my case) one must use UnbufferedSerial. That’s what I tried, but apparently one cannot launch an async RX serial with a char match using UnbufferedSerial, which on its current incarnation is not a replacement for RawSerial.

I’m not worried about printf, it is working.


Note that, simply, inheriting UnbufferedSerial publicly from Serialbase (now it is done privately) will allow to launch such async RX serial with char matching transaction by using gps.SerialBase::read(). Done just now and working.

Surely there must were some reasons to inherit privately, but doing that heavily restricts the usage of UnbufferedSerial compared to the previous RawSerial.


Hmm, I’d think that to communicate with an external device like that you would probably want to use BufferedSerial not UnbufferedSerial. With BufferedSerial, sends and receives are automatically done through interrupts in the background.