mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-16 13:47:35 +08:00
Additions to the Serial UART API (#22953)
- Added an empty constructor, setPort, and validatePort functions for Serial API - Changed GPS to not allocate Serial object dynamically - Moved access check on serial port name into the Serial API - Improved the Qurt platform validatePort Serial function to implement a more rigorous check. Added safety check to the setPort Serial function to make sure it isn't called after the port has been already opened.
This commit is contained in:
@@ -36,6 +36,10 @@
|
||||
namespace device
|
||||
{
|
||||
|
||||
Serial::Serial() :
|
||||
_impl(nullptr, 57600, ByteSize::EightBits, Parity::None, StopBits::One, FlowControl::Disabled) {}
|
||||
|
||||
|
||||
Serial::Serial(const char *port, uint32_t baudrate, ByteSize bytesize, Parity parity, StopBits stopbits,
|
||||
FlowControl flowcontrol) :
|
||||
_impl(port, baudrate, bytesize, parity, stopbits, flowcontrol)
|
||||
@@ -135,4 +139,14 @@ const char *Serial::getPort() const
|
||||
return _impl.getPort();
|
||||
}
|
||||
|
||||
bool Serial::validatePort(const char *port)
|
||||
{
|
||||
return SerialImpl::validatePort(port);
|
||||
}
|
||||
|
||||
bool Serial::setPort(const char *port)
|
||||
{
|
||||
return _impl.setPort(port);
|
||||
}
|
||||
|
||||
} // namespace device
|
||||
|
||||
Reference in New Issue
Block a user