I'm trying to configure a timer (on STM32F0 but I guess it's the same on the rest of the STM32F family) with Output Compare to get an interrupt for two different actions at two different time intervals. I for example plan to use Output Compare with a period of 1000 and have one channel fire an interrupt at 250 and another channel at 1000 (or 0). This way I can use one timer to get two different things done at different time intervals. In Cube I select only the NVIC "TIM1 capture compare interrupt"; I guess I don't need the "TIM1 break, trigger, update and commutation interrupts" (I don't even know what they are for). This will generate a TIM1_CC_IRQHandler(void) section in my interrupt file (stm32f0xx_it.c). I'm now trying to figure out how I can tell the difference between the interrupts generated by each of the channels; I have to find out what channel has caused the interrupt. Using HAL, there is __HAL_TIM_GET_FLAG and __HAL_TIM_GET_IT_SOURCE. Both have a parameter that specifies the CC (Capture/Compare) channel. So, what's the difference between both functions? Which one is best?
Looking at the TIM1 registers, I noticed that there's apprently only one register that could possibly tell me the same result: The CC1IF bit in the status register TIM1_SR is set when the first channel has reached a match between it's pulse setting (e.g. 250) and the running counter. So, if I check for this bit in the interrupt code section I can find out whether CH1 has caused the interrupt or not. Is that correct? And is this what actually happens in both HAL functions?
A last question: how do I reset the CC1IF bit? The reference manual says it's "cleared by software", but it doesn't tell how exactly. Is this the same than clearing an EXTI interrupt bit? (...by writing "1" to that same bit.)