Hi everyone,
I'm working on a proximity sensor implementation for the GEVCU7 board. Currently, I have a working polling-based implementation, but I need to convert it to interrupt-based reading for better performance.Here's my current polling-based code:
The code reads DIN0 (Digital Input 0) on the GEVCU7 board. I need help understanding:
Note: The GEVCU7 uses an IMXRT1062 processor (Teensy 4.x), and the digital inputs are handled through sys_io.cpp. If anyone has experience with interrupt-based input reading on this platform, I'd love to hear your insights.
I'm working on a proximity sensor implementation for the GEVCU7 board. Currently, I have a working polling-based implementation, but I need to convert it to interrupt-based reading for better performance.Here's my current polling-based code:
Code:
// ProximitySensor.cpp
void ProximitySensor::setup() {
Logger::console("PROX: Setup called");
tickHandler.detach(this);
Device::setup();
tickHandler.attach(this, CFG_TICK_INTERVAL_PROX);
Logger::console("PROX: Initial state of Pin 0: %d", systemIO.getDigitalIn(0));
}
void ProximitySensor::handleTick() {
uint8_t newState = systemIO.getDigitalIn(0);
currentState = newState;
if (currentState == 1) {
Logger::console("PROX: Object Detected! Pin State: %d", currentState);
}
}
The code reads DIN0 (Digital Input 0) on the GEVCU7 board. I need help understanding:
- Which interrupt vector should I use for DIN0?
- What's the proper way to set up the interrupt handler given GEVCU7's hardware architecture?
- How to properly integrate the interrupt handler with the existing Device framework?
Note: The GEVCU7 uses an IMXRT1062 processor (Teensy 4.x), and the digital inputs are handled through sys_io.cpp. If anyone has experience with interrupt-based input reading on this platform, I'd love to hear your insights.