mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
Convert ReadInterrupt* to return int64_t time (#1417)
HAL_ReadInterruptRisingTimestamp and HAL_ReadInterruptFallingTimestamp return time as a double. Instead, keep the raw integer count and move the double conversion into the C++ and Java code. This enables comparison of the time with other timers.
This commit is contained in:
committed by
Peter Johnson
parent
ef3a31aa20
commit
9207d788ab
@@ -96,18 +96,18 @@ double InterruptableSensorBase::ReadRisingTimestamp() {
|
||||
if (StatusIsFatal()) return 0.0;
|
||||
wpi_assert(m_interrupt != HAL_kInvalidHandle);
|
||||
int32_t status = 0;
|
||||
double timestamp = HAL_ReadInterruptRisingTimestamp(m_interrupt, &status);
|
||||
int64_t timestamp = HAL_ReadInterruptRisingTimestamp(m_interrupt, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return timestamp;
|
||||
return timestamp * 1e-6;
|
||||
}
|
||||
|
||||
double InterruptableSensorBase::ReadFallingTimestamp() {
|
||||
if (StatusIsFatal()) return 0.0;
|
||||
wpi_assert(m_interrupt != HAL_kInvalidHandle);
|
||||
int32_t status = 0;
|
||||
double timestamp = HAL_ReadInterruptFallingTimestamp(m_interrupt, &status);
|
||||
int64_t timestamp = HAL_ReadInterruptFallingTimestamp(m_interrupt, &status);
|
||||
wpi_setErrorWithContext(status, HAL_GetErrorMessage(status));
|
||||
return timestamp;
|
||||
return timestamp * 1e-6;
|
||||
}
|
||||
|
||||
void InterruptableSensorBase::SetUpSourceEdge(bool risingEdge,
|
||||
|
||||
Reference in New Issue
Block a user