Adafruit Trellis interrupt

Hi all

Hope this is the right place to get help for this.

I'm using a Teensy 3.5 with an adafruit trellis and I'm having a hard time finding information about how to use the interrupt pin on the trellis

I'm augmenting my normal keyboard with the trellis and a rotary encoder, with the Teensy in USB keyboard mode.

Because the rotary encoder is very sensitive to delays in the main loop, I want to avoid using the sample code from adafruit for the trellis, which continuously looks to see if any keys have been pressed on the trellis and includes delays.

Is there a resource I could use I order to find out how to use the interrupt pin on the trellis to avoid these timing issues?

I'm open to other suggestions too.

Hope that's clear enough.

I want to avoid using the sample code from adafruit for the trellis, which continuously looks to see if any keys have been pressed on the trellis and includes delays.

What if you just omit the delays? This is example code, nobody said you must not change it.

Is there a resource I could use I order to find out how to use the interrupt pin on the trellis to avoid these timing issues?

You can download the datasheet of the controlling chip from the Adafruit website. But I doubt it is worth the effort to adapt the library to use that interrupt. Remember, you cannot use I2C inside interrupt handlers! So you can set a flag in the interrupt handler and react on it in the normal loop. That doesn't keep you from seriously planning your loop tasks.

Because the rotary encoder is very sensitive to delays in the main loop

The rotary encoder may be a better candidate to attach to an interrupt.

Post your code, we may find more improvement potential.

Thanks very much for that.

I'll try all those things. I think the interrupt for the rotary encoder is where I'll start. I just want to make sure that I don't miss any steps in the encoder if it's rotating quickly.