void nvic_irq_enable(uint8_t nvic_irq, uint8_t nvic_irq_pre_priority, uint8_t nvic_irq_sub_priority){ uint32_t temp_priority = 0x00U, temp_pre = 0x00U, temp_sub = 0x00U; /* use the priority group value to get the temp_pre and the temp_sub */ switch ((SCB->AIRCR) ...
timer_interrupt_enable(TIMER2,TIMER_INT_CH0); nvic_irq_enable(TIMER2_IRQn, 1, 1); 5) 编写中断服务函数 void TIMER2_IRQHandler(void){……} 6) 使能定时器 timer_enable(TIMER2); 通过以上 6 步设置,定时器 2 的通道 0 就可以开始输入捕获了 外部时钟输入 TIMER1 通用定时器L0(TIMER1/2/3/4...
NVIC->IP[nvic_irq] = (uint8_t)temp_priority; /* enable the selected IRQ */ NVIC->ISER[nvic_irq >> 0x05U] = (uint32_t)0x01U << (nvic_irq & (uint8_t)0x1FU); } nvic_irq_enable()函数的参数说明表 参数nvic_irq是一个枚举变量,它定义了每一个中断的编号,具体定义在gd32f10x.h...
4) 使能捕获中断和NVIC timer_interrupt_enable(TIMER2,TIMER_INT_CH0); nvic_irq_enable(TIMER2_IRQn, 1, 1); 5) 编写中断服务函数 void TIMER2_IRQHandler(void){……} 6) 使能定时器 timer_enable(TIMER2); 通过以上 6 步设置,定时器 2 的通道 0 就可以开始输入捕获了 外部时钟输入 TIMER1 通用定...
nvic_irq_enable(SPI0_IRQn,0,1); 有关这两个函数的原型以及函数参数的说明,请见代码清单nvic_priority_group_set函数原型、参数nvic_prigroup说明表、代码清单nvic_irq_enable函数原型、nvic_irq_enable()函数的参数说明表。 代码清单nvic_priority_group_set 函数原型 ...
// nvic_irq_enable(DMA0_Channel3_IRQn, 0, 2); uart2_tx_state = 0; return; } 重新配置 uart2 串口的 DMA 接收通道 /** *@brief重新配置uart2串口的DMA接收通道 * *@retvalvoid* *@note*/staticvoiduart2_dma_rx_refcg(void){/* disable DMA and reconfigure */dma_channel_disable(DMA0, ...
nvic_irq_enable(EXTI1_IRQn,0,0);bsp_uart_init(&BOARD_UART);delay_ms(1000); printf_log("Example of key interrupt detection.\r\n");while (1){if(USER_KEY.press_timerms == PRESS_DOWN){/* 检测到按键被按下 */USER_KEY.press_timerms = PRESS_NONE;printf_log("USER_KEY is pressed ...
rcu_periph_clock_enable(RCU_RTC);rtc_register_sync_wait();} 复制代码 这部分是RTC设置函数,在...
nvic_irq_enable(UART3_IRQn, 1, 1); rcu_periph_clock_enable(RCU_GPIOC); rcu_periph_clock_enable(RCU_UART3); /* connect port to USARTx_Tx */ gpio_init(GPIOC, GPIO_MODE_AF_PP, GPIO_OSPEED_50MHZ, GPIO_PIN_10); /* connect port to USARTx_Rx */ ...
adc_interrupt_enable(ADC_INT_EOC);nvic_irq_enable(ADC_CMP_IRQn,0U); 然后再 中断处理函数中读取数值,这里只是通过串口输出 ADC 采集到的数值: ///* ADC */ /*! \brief this function handles ADC exception \param[in] none \param[out] none \retval none */ void ADC_CMP_...