updated second pwm input channel ISR properly

This commit is contained in:
Stephen Dwyer
2011-11-07 12:58:52 -07:00
parent fff2dabbb8
commit 1606b7e058
@@ -144,18 +144,25 @@ void pwm_input_isr2(void)
t_fall = T0CR0;
T0CCR |= TCCR_CR0_R;
T0CCR &= ~TCCR_CR0_F;
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_LOW
#else
pwm_input_duration[1] = t_fall - t_rise;
pwm_input_valid[1] = TRUE;
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_HIGH
pwm_input_duty_tics[1] = t_fall - t_rise;
pwm_input_duty_valid[1] = TRUE;
#elif USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_LOW
pwm_input_period_tics[1] = t_fall - t_oldfall;
pwm_input_period_valid[1] = TRUE;
t_oldfall = t_fall;
#endif //ACTIVE_HIGH
} else if (T0CCR & TCCR_CR0_R) {
t_rise = T0CR0;
T0CCR |= TCCR_CR0_F;
T0CCR &= ~TCCR_CR0_R;
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_LOW
pwm_input_duration[1] = t_rise - t_fall;
pwm_input_valid[1] = TRUE;
pwm_input_duty_tics[1] = t_rise - t_fall;
pwm_input_duty_valid[1] = TRUE;
#elif USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_HIGH
pwm_input_period_tics[1] = t_rise - t_oldrise;
pwm_input_period_valid[1] = TRUE;
t_oldrise = t_rise;
#endif //ACTIVE_LOW
}
}