本帖最后由 abettertmr 于 2023-6-7 18:35 编辑
在cw32f030_gtim.h中第269行发现的一处bug,会导致用GTIM_ITConfig(CW_GTIM1, GTIM_IT_OV, ENABLE)配置通用定时器中断时,出现assert failed//原代码:
#define IS_GTIM_IT(IT) (((IT) & 0xFFFFFD80 == 0x0UL) && ((IT) != 0x0UL))
//其中"&"比"=="的运算优先级低
//更正后:
#define IS_GTIM_IT(IT) ((((IT) & 0xFFFFFD80) == 0x0UL) && ((IT) != 0x0UL))
20230607 18:25更贴新发现bug://cw32f030_rcc.c:
//原代码:
void RCC_APBPeriphClk_Enable2(uint32_t Periph,FunctionalState NewState)
{
assert_param(IS_RCC_APB1_PERIPH(Periph));
if (NewState != DISABLE)
{
CW_SYSCTRL->APBEN2 |= Periph;
}
else
{
CW_SYSCTRL->APBEN2 &= (~Periph);
}
}
//另一处:
void RCC_APBPeriphReset2(uint32_t Periph,FunctionalState NewState)
{
assert_param(IS_RCC_APB1_PERIPH(Periph));
if (NewState != DISABLE)
{
CW_SYSCTRL->APBRST2 |= Periph;
}
else
{
CW_SYSCTRL->APBRST2 &= (~Periph);
}
}
//以上两处assert_param语句应该为:
assert_param(IS_RCC_APB2_PERIPH(Periph));
|