STM32 timers: avoid RMW when clearing interrupt flags

All defined bits are rc_w0.

The paranoid version of this would write 0 to the reserved bits (0 is the
"reset value"), but this would require knowing which flags are valid on the
actual platform, and adding the corresponding macros.
This commit is contained in:
fenugrec 2015-07-27 17:27:25 -04:00 committed by Karl Palsson
parent 1d36685759
commit 410f2dd5a1
1 changed files with 2 additions and 1 deletions

View File

@ -280,7 +280,8 @@ tim_reg_base
void timer_clear_flag(uint32_t timer_peripheral, uint32_t flag)
{
TIM_SR(timer_peripheral) &= ~flag;
/* All defined bits are rc_w0 */
TIM_SR(timer_peripheral) = ~flag;
}
/*---------------------------------------------------------------------------*/