/* Set Input Capture Prescaler. 
Set the number of events between each capture. */
void timer_ic_set_prescaler(uint32_t timer_peripheral, enum tim_ic_id ic, enum tim_ic_psc psc)
/* Set Input Capture Prescaler. 
Set the number of events between each capture. */
void timer_ic_set_prescaler(uint32_t timer_peripheral, enum tim_ic_id ic, enum tim_ic_psc psc)
{
	switch (ic) {
	case TIM_IC1:
		TIM_CCMR1(timer_peripheral) &= ~TIM_CCMR1_IC1PSC_MASK;
		TIM_CCMR1(timer_peripheral) |= psc << 2;
		break;
	case TIM_IC2:
		TIM_CCMR1(timer_peripheral) &= ~TIM_CCMR1_IC2PSC_MASK;
		TIM_CCMR1(timer_peripheral) |= psc << 10;
		break;
	case TIM_IC3:
		TIM_CCMR2(timer_peripheral) &= ~TIM_CCMR2_IC3PSC_MASK;
		TIM_CCMR2(timer_peripheral) |= psc << 2;
		break;
	case TIM_IC4:
		TIM_CCMR2(timer_peripheral) &= ~TIM_CCMR2_IC4PSC_MASK;
		TIM_CCMR2(timer_peripheral) |= psc << 10;
		break;
	}
}