/* Return Interrupt Source. 
Returns true if the specified interrupt flag (UIF, TIF or CCxIF, with BIF or COMIF for advanced timers) was set and the interrupt was enabled. If the specified flag is not an interrupt flag, the function returns false. */
bool timer_interrupt_source(uint32_t timer_peripheral, uint32_t flag)
/* Return Interrupt Source. 
Returns true if the specified interrupt flag (UIF, TIF or CCxIF, with BIF or COMIF for advanced timers) was set and the interrupt was enabled. If the specified flag is not an interrupt flag, the function returns false. */
bool timer_interrupt_source(uint32_t timer_peripheral, uint32_t flag)
{
	if (((TIM_SR(timer_peripheral) &
		TIM_DIER(timer_peripheral) & flag) == 0) ||
		(flag > TIM_SR_BIF)) {
		return false;
	}
	return true;
}