| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- /*!
- \file systick.c
- \brief the systick configuration file
- */
- /*
- Copyright (C) 2017 GigaDevice
- 2017-06-06, V1.0.0, firmware for GD32F3x0
- */
- #include "gd32f3x0.h"
- #include "systick.h"
- volatile static uint32_t delay;
- /*!
- \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 delay_1ms(uint32_t count)
- {
- delay = count;
- while(0U != delay){
- }
- }
- /*!
- \brief delay decrement
- \param[in] none
- \param[out] none
- \retval none
- */
- void delay_decrement(void)
- {
- if (0U != delay){
- delay--;
- }
- }
|