[hal] Convert DutyCycle Raw output to be a high time measurement (#4466)

The existing raw time has an issue where it jumps around, as in the FPGA if the frequency is not a multiple or divisor of 25 Mhz it jumps around by 1 every second. While waiting on an FPGA change, update the API to make raw output give nanoseconds rather then a scaled value. This does a longer read cycle to get the correct value, but in the future if a fast FPGA function is added this can be easily changed.
This commit is contained in:
Thad House
2022-10-12 10:15:09 -07:00
committed by GitHub
parent 89a3d00297
commit 87a64ccedc
10 changed files with 79 additions and 63 deletions

View File

@@ -74,15 +74,15 @@ Java_edu_wpi_first_hal_DutyCycleJNI_getOutput
/*
* Class: edu_wpi_first_hal_DutyCycleJNI
* Method: getOutputRaw
* Method: getHighTime
* Signature: (I)I
*/
JNIEXPORT jint JNICALL
Java_edu_wpi_first_hal_DutyCycleJNI_getOutputRaw
Java_edu_wpi_first_hal_DutyCycleJNI_getHighTime
(JNIEnv* env, jclass, jint handle)
{
int32_t status = 0;
auto retVal = HAL_GetDutyCycleOutputRaw(
auto retVal = HAL_GetDutyCycleHighTime(
static_cast<HAL_DutyCycleHandle>(handle), &status);
CheckStatus(env, status);
return retVal;