#ifndef SYSTICK_H
#define SYSTICK_H

#include <stdint.h>

#include "ch32fun.h"
#include "ch32v20xhw.h"

#define SYSTICK_ONE_MILLISECOND ((uint32_t)FUNCONF_SYSTEM_CORE_CLOCK / 1000)
#define SYSTICK_ONE_MICROSECOND ((uint32_t)FUNCONF_SYSTEM_CORE_CLOCK / 1000000)

#define millis() (systick_millis)
#define micros() (SysTick->CNT / SYSTICK_ONE_MICROSECOND)

#endif  // SYSTICK_H
