gpio_init(GPIOA, GPIO_MODE_IN_FLOATING, GPIO_OSPEED_50MHZ, GPIO_PIN_10); nvic_irq_enable(USART0_IRQn, 2U, 0U); #elif defined GD32F1X0 || GD32F4XX || GD32F3X0 || GD32E230 #if defined GD32F1X0 || GD32F3X0 || GD32E230 /* connect port to USARTx_Tx USARTx_Rx*/ gpio...
参数 nvic_prigroup 说明表 代码清单nvic_irq_enable 函数原型 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 ...
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 通用定...
/* enable and set key EXTI interrupt to the lowest priority */ nvic_irq_enable(EXTI0_1_IRQn, 2U); #elif defined GD32F4XX nvic_irq_enable(EXTI0_IRQn, 2U,0U); #elif defined GD32F1X0 || GD32F3X0 nvic_irq_enable(EXTI0_1_IRQn, 2U,0U); #endif /* connect key EXTI line to ...
nvic_irq_enable()函数的参数说明表 参数nvic_irq是一个枚举变量,它定义了每一个中断的编号,具体定义...
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...
** 1.认识时钟 HXTAL:高速外部时钟;LXTAL:低速外部时钟;IRC8M:高速内部时钟;IRC40K:低速内部...
rcu_periph_clock_enable(RCU_RTC);rtc_register_sync_wait();} 复制代码 这部分是RTC设置函数,在...
void nvic_priority_group_set(uint32_t nvic_prigroup) 而且GD32E230仅支持4级抢占优先级,不支持子优先级,所以移植之后,优先级需要更改成以下函数: /***中断抢占与子优先级***/ void nvic_irq_enable(uint8_t nvic_irq, uint8_t nvic_irq_pre_priority, uint8_t nvic_irq_sub_priority) 11...
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 ...