mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-30 03:27:33 +08:00
updated second pwm input channel ISR properly
This commit is contained in:
@@ -144,18 +144,25 @@ void pwm_input_isr2(void)
|
|||||||
t_fall = T0CR0;
|
t_fall = T0CR0;
|
||||||
T0CCR |= TCCR_CR0_R;
|
T0CCR |= TCCR_CR0_R;
|
||||||
T0CCR &= ~TCCR_CR0_F;
|
T0CCR &= ~TCCR_CR0_F;
|
||||||
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_LOW
|
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_HIGH
|
||||||
#else
|
pwm_input_duty_tics[1] = t_fall - t_rise;
|
||||||
pwm_input_duration[1] = t_fall - t_rise;
|
pwm_input_duty_valid[1] = TRUE;
|
||||||
pwm_input_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
|
#endif //ACTIVE_HIGH
|
||||||
} else if (T0CCR & TCCR_CR0_R) {
|
} else if (T0CCR & TCCR_CR0_R) {
|
||||||
t_rise = T0CR0;
|
t_rise = T0CR0;
|
||||||
T0CCR |= TCCR_CR0_F;
|
T0CCR |= TCCR_CR0_F;
|
||||||
T0CCR &= ~TCCR_CR0_R;
|
T0CCR &= ~TCCR_CR0_R;
|
||||||
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_LOW
|
#if USE_PWM_INPUT2 == PWM_PULSE_TYPE_ACTIVE_LOW
|
||||||
pwm_input_duration[1] = t_rise - t_fall;
|
pwm_input_duty_tics[1] = t_rise - t_fall;
|
||||||
pwm_input_valid[1] = TRUE;
|
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
|
#endif //ACTIVE_LOW
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user