Changed the default baudrate handling around a little to make it cleaner

This commit is contained in:
Eric Katzfey
2023-07-20 10:39:30 -07:00
parent 83f3bc4dff
commit 14a3df8b60
3 changed files with 29 additions and 20 deletions
+4 -8
View File
@@ -7,14 +7,10 @@ Serial::Serial(const char *port, uint32_t baudrate, ByteSize bytesize, Parity pa
FlowControl flowcontrol) :
_impl(port, baudrate, bytesize, parity, stopbits, flowcontrol)
{
// TODO: Device
// set_device_bus_type(device::Device::DeviceBusType::DeviceBusType_SERIAL);
// char c = _port[strlen(_port) - 1]; // last digit of path (eg /dev/ttyS2)
// set_device_bus(c - 48); // sub 48 to convert char to integer
// If no baudrate was specified then set it to a reasonable default value
if (baudrate == 0) {
(void) _impl.setBaudrate(9600);
}
}
Serial::~Serial()
-4
View File
@@ -23,10 +23,6 @@ SerialImpl::SerialImpl(const char *port, uint32_t baudrate, ByteSize bytesize, P
} else {
_port[0] = 0;
}
// Start off with a valid bitrate to make sure open can succeed
if (_baudrate == 0) { _baudrate = 9600; }
}
SerialImpl::~SerialImpl()