AsynchronousInterrupt "polarity" in simulation #6440
Labels
component: wpilibc
WPILib C++
component: wpilibj
WPILib Java
os: simulation
type: bug
Something isn't working.
Describe the question you have.
While looking at the
AsynchronousInterrupt
class, I noticed that the boolean values passed into the callback don't seem to line up with the edge that actually triggered. The documentation (like this link) simply states that the booleans indicate which edge fired the interrupt. In both C++ and Java, it seems to be "active low", that is, it passes infalse
for the edge that triggered the interrupt. Just wanted to check if that was the expected behavior?Apologies in advance if this is documented elsewhere and I just missed it, am not using the
DigitalInput
simulation correctly, or am misinterpreting what this is supposed to look like. I tried to check all of the information I could find about it, including the source code and theSynchronousInterrupt
documentation. I'm not very familiar with the lower-level HAL stuff though, unfortunately.Describe the reason for your confusion.
I'm unsure what the expected behavior should be. Just by reading the description, I thought the triggering edge might have been supposed to be
true
.Is your question related to a problem? Please describe.
I initially set up some code to play around with the interrupts and noticed that the initial logic I was using didn't work, because the boolean values were the opposite of what I thought was the "logical" (maybe?) setup. Of course, this is probably user error, hence the question :)
I had initially done something like:
Additional context
Code that can reproduce this in simulation (on Linux and macOS, at least)
Example screenshot, showing the interrupt set up to fire on active low. Whenever the DIO input is changed from 1 to 0, the message is printed, but with the
falling
boolean set to be 0.Of course, I see the same behavior if both edges or just the rising edge is set, where the triggered edge is passed in as 0.
Thank you! :)
The text was updated successfully, but these errors were encountered: