@peekay123 this is RAD DUDE! Good job
I was looking at your example code and was thinking if you really couldn’t tolerate disabling interrupts for something really critical, then there is another way to do this:
// to read a variable which the interrupt code writes, we
// can read it twice and if it is the same, we know the
// interrupt service routine has not changed it while
// we were reading it. If you have a super fast interrupt
// interval, this will never work, however anything slower
// than 1us should work.
blinkCopy = blinkCount;
while(blinkCopy != blinkCount) blinkCopy = blinkCount;
Obviously this is just a suggestion for someone that can’t tolerate disabling interrupts, and should not be used by default without thinking about how all of the timing works.
Based on your example code, it’s conceivable that two of the interrupts could fire asynchronously within 1us of each other, but the third might not. Thus, the while loop can perform the read a 3rd or 4th time if needed.