Help needed: Converting polling-based proximity sensor to interrupt-based reading on GEVCU7

Lucifer D

Member
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:

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:
  1. Which interrupt vector should I use for DIN0?
  2. What's the proper way to set up the interrupt handler given GEVCU7's hardware architecture?
  3. How to properly integrate the interrupt handler with the existing Device framework?
Any guidance would be greatly appreciated!

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.
 
Looks like this product is based on MicroMod Teensy. Quick search turned up this website, but I couldn't find a schematic or hardware reference that tells what Teensy pin "DIN0" really is.

If I found the wrong thing and you really have something other than this picture, please let me know. Your question didn't have any links, so I'm not 100% sure I really found the right info?

1736513895773.png
 
Hi PaulStoffregen,

Thank you for your prompt response.

Yes, this is indeed the board I am currently working with. You can find the link to the board [here]. You're correct—I'm using this board at the moment.

I can successfully read its digital Pin 0, and my code is working fine for that functionality. However, I'm unsure how to integrate the logic for the interrupt.

Whenever, the interrupt occurs on the Digital Pin 0, I have to read it.
 
I don't know anything about these software libraries it uses, like "systemIO". Can't help with that.

Using the normal Arduino functions, you would use the attachInterrupt function.

But is it really (Arduino) pin 0 on Teensy? I saw this in the PDF on page 38.

1736515750700.png
 
Thank you for your response. I understand your concern about not being familiar with the software libraries, such as "systemIO."

Perhaps @CollinK could help us out since he's the one who developed these software libraries for GEVCU and is highly experienced in this area. His insights might be invaluable for resolving this issue.
 
Back
Top