Disable interrupts on access to count1 and count2, because these variables are updated in the ISRs. Volatile is correct but not sufficient to implement atomic access.
Disable interrupts on access to count1 and count2, because these variables are updated in the ISRs. Volatile is correct but not sufficient to implement atomic access.