在GD32f10x_misc.c文件中,nvic_priority_group_set函数用于设置多少位用于抢占优先级,多少位用于子优先级;nvic_irq_enable函数用于设置相应中断的抢占优先级和子优先级的等级。比如现在要设置SPI0的中断,其抢占优先级和子优先级的位数均为2,抢占优先级的等级为0,子优先级 的等级为1,那么代码如代码清单SPI0...
nvic_priority_group_set(NVIC_PRIGROUP_PRE2_SUB2); nvic_irq_enable(SPI0_IRQn,0,1); 有关这两个函数的原型以及函数参数的说明,请见代码清单nvic_priority_group_set函数原型、参数nvic_prigroup说明表、代码清单nvic_irq_enable函数原型、nvic_irq_enable()函数的参数说明表。 代码清单nvic_priority_group_set...
void nvic_priority_group_set(uint32_t nvic_prigroup) { /* set the priority group value */ SCB->AIRCR = NVIC_AIRCR_VECTKEY_MASK | nvic_prigroup; } 注意:如果中断优先级配置为2位抢占和2位此优先级的话,抢占优先级配置为4(二进制为100b),优先级配置越界,实际配置进去的优先级为0,最高优先级,因...
nvic_priority_group_set(NVIC_PRIGROUP_PRE2_SUB2);temp_pre=2U;temp_sub=0x2U;} /* get the ...
C /*! \brief set the priority group \param[in] nvic_prigroup: the NVIC priority group \arg NVIC_PRIGROUP_PRE0_SUB4:0 bits for pre-emption priority 4 bits for subpriority \arg NVIC_PRIGROUP_PRE1_SUB3:1 bits for pre-emption priority 3 bits for subpriority \arg NVIC_PRIGROUP_PRE2_SUB...
nvic_priority_group_set(NVIC_PRIGROUP_PRE2_SUB2); nvic_irq_enable(SPI0_IRQn,0,1); 有关这两个函数的原型以及函数参数的说明,请见代码清单nvic_priority_group_set函数原型、参数nvic_prigroup说明表、代码清单nvic_irq_enable函数原型、nvic_irq_enable()函数的参数说明表。 代码清单nvic_priority_group_set...
在GD32f10x_misc.c文件中,nvic_priority_group_set函数用于设置多少位用于抢占优先级,多少位用于子优先级;nvic_irq_enable函数用于设置相应中断的抢占优先级和子优先级的等级。比如现在要设置SPI0的中断,其抢占优先级和子优先级的位数均为2,抢占优先级的等级为0,子优先级 的等级为1,那么代码如代码清单SPI0中断...
TIMER_INT_UP);timer_enable(TIMER2);nvic_priority_group_set(NVIC_PRIGROUP_PRE2_SUB2);nvic_irq...
nvic_priority_group_set(NVIC_PRIGROUP_PRE2_SUB2);nvic_irq_enable(WWDGT_IRQn,2U,0U);wwdgt_interrupt_enable();//开启窗口看门狗中断 4)使能看门狗 这一步在库函数里面是通过一个函数实现的: voidwwdgt_enable(void); 该函数使能窗口看门狗。
\arg NVIC_PRIGROUP_PRE3_SUB1: 3 bit 抢占优先级 ,1 bit 子优先级 \arg NVIC_PRIGROUP_PRE4_SUB0: 4 bit 抢占优先级 ,0 bit 子优先级 \param[out] none \retval none */ void nvic_priority_group_set(uint32_t nvic_prigroup) { /* set the priority group value */ ...