Simple ISR for DMA
I'm losing my mind a little, because this seems like it should be a simple task.
I have configured my I2C module to enable DMA and interrupts:

I can confirm that my call to HAL_I2C_Master_Transmit_DMA returns OK. I can also confirm that the generated DMA1_Channel2_IRQHandler is called. That's where things start breaking down.
Other modules in the HAL library give you a hook (e.g.HAL_GPIO_EXTI_Callback) signature that you can implement and have it be called by the HAL top-level ISR, but it seems like DMA has not implemented that. Instead, the HAL DMA module implements HAL_DMA_RegisterCallback, and you can successfully call it - but then those callback pointers are overwritten by ones in the HAL itself.
OK... so then I tried copying some of the code from HAL_DMA_IRQHandler to (re-)determine which DMA flag applies:
static void dma_states(
const DMA_HandleTypeDef *restrict hdma,
bool *restrict is_complete,
bool *restrict is_error
) {
const uint32_t flag_it = hdma->DmaBaseAddress->ISR;
const uint32_t source_it = hdma->Instance->CCR;
*is_complete = (flag_it & (DMA_FLAG_TC1 << hdma->ChannelIndex)) && (source_it & DMA_IT_TC);
*is_error = (flag_it & (DMA_FLAG_TE1 << hdma->ChannelIndex)) && (source_it & DMA_IT_TE);
}
And this evaluates complete and error to false in both cases, always seemingly because the TC and TE flags have not been enabled by the HAL in CCR.
What gives? Is this implementation just broken? Surely the implementers didn't expect users to have to bit-fiddle in CCR to get the most basic interrupts.
