Systick实现中断-GD32

定时器中断-GD32

在这里插入图片描述

include "gd32f10x.h"
#include "systick.h"
#include "LED.h"

volatile static uint32_t delay_reload;
volatile static uint32_t delay_value;

/*!
    \brief      configure systick
    \param[in]  none
    \param[out] none
    \retval     none
*/
void systick_config(void)
{
    /* setup systick timer for 1000Hz interrupts */
    if (SysTick_Config(SystemCoreClock / 1000U)){
        /* capture error */
        while (1){
        }
    }
    /* configure the systick handler priority */
    NVIC_SetPriority(SysTick_IRQn, 0x00U);
}

/*!
    \brief      delay a time in milliseconds
    \param[in]  count: count in milliseconds
    \param[out] none
    \retval     none
*/
void inter_1ms(uint32_t count)
{
    delay_reload = count;
		delay_value = delay_reload;
}

/*!
    \brief      delay decrement
    \param[in]  n

猜你喜欢

转载自blog.csdn.net/qq_45159887/article/details/131153068