/* Set Input Capture Filter Parameters. 
Set the input filter parameters for an input channel, specifying:  */
void timer_ic_set_filter(uint32_t timer_peripheral, enum tim_ic_id ic, enum tim_ic_filter flt)
/* Set Input Capture Filter Parameters. 
Set the input filter parameters for an input channel, specifying:  */
void timer_ic_set_filter(uint32_t timer_peripheral, enum tim_ic_id ic, enum tim_ic_filter flt)
{
	switch (ic) {
	case TIM_IC1:
		TIM_CCMR1(timer_peripheral) &= ~TIM_CCMR1_IC1F_MASK;
		TIM_CCMR1(timer_peripheral) |= flt << 4;
		break;
	case TIM_IC2:
		TIM_CCMR1(timer_peripheral) &= ~TIM_CCMR1_IC2F_MASK;
		TIM_CCMR1(timer_peripheral) |= flt << 12;
		break;
	case TIM_IC3:
		TIM_CCMR2(timer_peripheral) &= ~TIM_CCMR2_IC3F_MASK;
		TIM_CCMR2(timer_peripheral) |= flt << 4;
		break;
	case TIM_IC4:
		TIM_CCMR2(timer_peripheral) &= ~TIM_CCMR2_IC4F_MASK;
		TIM_CCMR2(timer_peripheral) |= flt << 12;
		break;
	}
}