Hi all!
I’m trying to read an optical RPM sensor with the Pixhawk. The sensor outputs a high voltage when the surface is reflective and a low voltage when the surface is dark. I have reflective tape around half of the motor, and I would like to trigger an interrupt on the rising or falling edge to increment a counter.
In the ArduPilot AP_HAL library, there is a function in the GPIO header that is called “attach_interrupt”. When one looks in the AP_HAL_PX4 library at the GPIO.cpp file, “attach_interrupt” is not expanded (it just returns true). I would like to integrate this sensor on the AUX FMU pins (50-55). My questions:
- Is there a way to incorporate this sensor without using interrupts?
- How would one write the function for attaching interrupts, if they are available on the AUX pins?
Thank you for your help.