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

@@ -98,20 +98,18 @@ void SysTick_Handler(void)
{
}
void TIMER16_IRQHandler(void) {
if (timer_interrupt_flag_get(TIMER16, TIMER_INT_FLAG_UP) == SET)
void TIMER5_IRQHandler(void) {
if (timer_interrupt_flag_get(LED_TIMER, TIMER_INT_FLAG_UP) == SET)
{
timer_interrupt_flag_clear(TIMER16, TIMER_INT_FLAG_UP);
timer_interrupt_flag_clear(LED_TIMER, TIMER_INT_FLAG_UP);
static uint8_t led_status = 0;
if (led_status)
{
//! turn on led & reconfig timer13 period to 19000(1900ms)
gpio_bit_write(GPIOA, GPIO_PIN_9, RESET);
timer_autoreload_value_config(TIMER16, 19200);
gpio_bit_write(LED_PORT, LED_PIN, RESET);
timer_autoreload_value_config(LED_TIMER, 19200);
} else {
//! turn off led & reconfig timer13 period to 1000(100ms)
gpio_bit_write(GPIOA, GPIO_PIN_9, SET);
timer_autoreload_value_config(TIMER16, 800);
gpio_bit_write(LED_PORT, LED_PIN, SET);
timer_autoreload_value_config(LED_TIMER, 800);
}
led_status = !led_status;
}