I am currently working on a project where I have two encoders connected to my Teensy 4.1. As of right now I am only focusing on one but if I am not mistaken using this library to sample the pin of the second shouldn't be an issue as there are multiple channels. I am using the FreqMeasureMulti library to get the time the pulse is high (I believe using the countToNanoSeconds method and with the right mode in the constructor is the way to do it, please correct me if wrong), but I need to also have a direction.
I've been looking through the source code of the library (specifically the FreqMeasureMultiIMXRT.h and .cpp since those look to be the ones being used if using a Teensy 4.1) trying to understand and find the interrupt function so that I can set a variable to millis() in order to get a time which if I do this for both pulses of the encoder I can determine the direction by checking which one is first. If someone could point me where in the code I could find this I would appreciate it. Or if you have an alternative to offer in addition to answering my question I would like to hear that as well.
I've been looking through the source code of the library (specifically the FreqMeasureMultiIMXRT.h and .cpp since those look to be the ones being used if using a Teensy 4.1) trying to understand and find the interrupt function so that I can set a variable to millis() in order to get a time which if I do this for both pulses of the encoder I can determine the direction by checking which one is first. If someone could point me where in the code I could find this I would appreciate it. Or if you have an alternative to offer in addition to answering my question I would like to hear that as well.