mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[wpilibc] Transition C++ classes to units::second_t (#3396)
A lot of these are breaking changes. frc::Timer was replaced with the contents of frc2::Timer. The others were in-place argument changes or removing deprecated non-unit overloads.
This commit is contained in:
@@ -31,7 +31,7 @@ SerialPort::SerialPort(int baudRate, Port port, int dataBits,
|
||||
FRC_CheckErrorStatus(status, "SetSerialStopBits {}", stopBits);
|
||||
|
||||
// Set the default timeout to 5 seconds.
|
||||
SetTimeout(5.0);
|
||||
SetTimeout(5_s);
|
||||
|
||||
// Don't wait until the buffer is full to transmit.
|
||||
SetWriteBufferMode(kFlushOnAccess);
|
||||
@@ -61,7 +61,7 @@ SerialPort::SerialPort(int baudRate, std::string_view portName, Port port,
|
||||
FRC_CheckErrorStatus(status, "SetSerialStopBits {}", stopBits);
|
||||
|
||||
// Set the default timeout to 5 seconds.
|
||||
SetTimeout(5.0);
|
||||
SetTimeout(5_s);
|
||||
|
||||
// Don't wait until the buffer is full to transmit.
|
||||
SetWriteBufferMode(kFlushOnAccess);
|
||||
@@ -122,9 +122,9 @@ int SerialPort::Write(std::string_view buffer) {
|
||||
return retVal;
|
||||
}
|
||||
|
||||
void SerialPort::SetTimeout(double timeout) {
|
||||
void SerialPort::SetTimeout(units::second_t timeout) {
|
||||
int32_t status = 0;
|
||||
HAL_SetSerialTimeout(m_portHandle, timeout, &status);
|
||||
HAL_SetSerialTimeout(m_portHandle, timeout.to<double>(), &status);
|
||||
FRC_CheckErrorStatus(status, "{}", "SetTimeout");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user