commit | 39917909dfd39d2f7a83df2670c51521dc7f078c | [log] [tgz] |
---|---|---|
author | Austin Schuh <austin.linux@gmail.com> | Sun Apr 09 16:23:31 2017 -0700 |
committer | Austin Schuh <austin.linux@gmail.com> | Sun Apr 09 17:19:20 2017 -0700 |
tree | 647d52e5bc1b3d30921480f95bc1aee079ea374e | |
parent | d98f3930ba171d8c768564736ff63a94ff3829fa [diff] |
Applied https://github.com/wpilibsuite/allwpilib/pull/503 WPILib is handling interrupts incorrectly. Backport their fix. Change-Id: I14cad35799482dd4665cdb57816e2e8fab474f1d
diff --git a/third_party/allwpilib_2017/wpilibc/athena/src/InterruptableSensorBase.cpp b/third_party/allwpilib_2017/wpilibc/athena/src/InterruptableSensorBase.cpp index f5a006d..7545b1b 100644 --- a/third_party/allwpilib_2017/wpilibc/athena/src/InterruptableSensorBase.cpp +++ b/third_party/allwpilib_2017/wpilibc/athena/src/InterruptableSensorBase.cpp
@@ -108,7 +108,13 @@ result = HAL_WaitForInterrupt(m_interrupt, timeout, ignorePrevious, &status); wpi_setErrorWithContext(status, HAL_GetErrorMessage(status)); - return static_cast<WaitResult>(result); + // Rising edge result is the interrupt bit set in the byte 0xFF + // Falling edge result is the interrupt bit set in the byte 0xFF00 + // Set any bit set to be true for that edge, and AND the 2 results + // together to match the existing enum for all interrupts + int32_t rising = (result & 0xFF) ? 0x1 : 0x0; + int32_t falling = ((result & 0xFF00) ? 0x0100 : 0x0); + return static_cast<WaitResult>(falling | rising); } /**