encoder library: read without disabling interrupts

thomasp

Active member
Hi,

I would like to suggest adding a class method to the official encoder library that allows optional reading of encoders via interrupt enabled Teensy pins without globally disabling / re-enabling all interrupts on each encoder position read.

I have built a project that uses 12 high resolution optical encoders (2000 PPR) using Paul's encoder library and this obviously generates a significant amount of encoder position changes / reads. I need to avoid any chance of conflicts with other libraries that depend on interrupts. The small potential position inconsistency is inconsequential due to the high resolution of my encoders.

This is the addition I made to the #ifdef ENCODER_USE_INTERRUPTS section:

Code:
	inline int32_t readFuzzy() { // interrupts are not disabled on read
		return encoder.position;
	}

thanks
 
Back
Top