[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:
Tyler Veness
2021-05-28 22:06:59 -07:00
committed by GitHub
parent 827b17a52b
commit e09293a15e
99 changed files with 503 additions and 790 deletions

View File

@@ -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");
}