Hi,
I am using a LoRa-E5. I have to send a break signal through the serial. set_break and clear_break can’t be used because of private member of SerialBase.
It seems to be just an error in the documentation. According to the source code mbed-os/drivers/include/drivers/SerialBase.h the methods set_break() and clear_break() are public:
class SerialBase : private NonCopyable<SerialBase> {
public:
...
/** Generate a break condition on the serial line
* NOTE: Clear break needs to run at least one frame after set_break is called
*/
void set_break();
/** Clear a break condition on the serial line
* NOTE: Should be run at least one frame after set_break is called
*/
void clear_break();
...
It’s not just documentation. Compiler tells me that error:
Compile [ 1.0%]: main.cpp
[Error] main.cpp@114,11: 'set_break' is a private member of 'mbed::SerialBase'
[Error] main.cpp@116,11: 'clear_break' is a private member of 'mbed::SerialBase'
[Warning] main.cpp@236,26: 'call_in' is deprecated: Pass a chrono duration, not an integer millisecond count. For example use `5s` rather than `5000`. [since mbed-os-6.0.0] [-Wdeprecated-declarations]
[Wa
I just “hacked” a new method into to BufferedSerial. When calling set_break() and monitoring on my Osci it does not realy react how I expected it. It seams that set_break itself returns to clear_break. So I couldn’t control the duration of the break signal.
The error message is not exact. The problem is that the SerialBase is a private ancestor of the BufferedSerial.
Try to create a new class, e.g. LoRaBufferedSerial, by copy&paste the BufferedSerial and modify it as below:
class LoRaBufferedSerial:
public SerialBase, // replace private with public
public FileHandle,
private NonCopyable<LoRaBufferedSerial> { // replace BufferedSerial with LoRaBufferedSerial
public:
...
This does not really make sense to me. Ok its a workarround for me, but I am loosing every bugfix on BufferedSerial in the future.
Sending a break signal is essential for handling serial interfaces (DMX512, SDI-12, …), so for what reason is SerialBase made private and therefore blocked for further usage?
Where do I place feature requests for mbed os ? In Github?