change the timer of LED to TIMER5(basic timer)

This commit is contained in:
2024-09-25 11:00:47 +08:00
parent 4252d59581
commit 212ffff06b
3 changed files with 15 additions and 16 deletions

View File

@@ -6,8 +6,6 @@
#include "gd32e23x.h"
#include "systick.h"
uint8_t speed_pwm = 30; //bldc default pwm is 30
void led_config(void)
{
rcu_periph_clock_enable(LED_RCU);
@@ -16,8 +14,8 @@ void led_config(void)
gpio_output_options_set(LED_PORT, GPIO_OTYPE_PP, GPIO_OSPEED_50MHZ, LED_PIN);
gpio_bit_write(LED_PORT, LED_PIN, SET);
rcu_periph_clock_enable(RCU_TIMER13);
timer_deinit(RCU_TIMER13);
rcu_periph_clock_enable(LED_TIMER_RCU);
timer_deinit(LED_TIMER);
timer_parameter_struct timer_initpara;
timer_struct_para_init(&timer_initpara);
@@ -30,8 +28,10 @@ void led_config(void)
timer_auto_reload_shadow_enable(LED_TIMER);
timer_interrupt_enable(LED_TIMER, TIMER_INT_UP);
nvic_irq_enable(LED_IRQ, 3);
timer_enable(LED_TIMER);
nvic_irq_enable(LED_IRQ, 0);
}
void usart_config(void)