first commit

This commit is contained in:
2025-11-30 04:47:14 +06:00
commit dc5194f1c8
16 changed files with 2599 additions and 0 deletions

19
inc/systick.h Normal file
View File

@@ -0,0 +1,19 @@
#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)
extern volatile uint32_t systick_millis;
#define millis() (systick_millis)
#define micros() (SysTick->CNT / SYSTICK_ONE_MICROSECOND)
void systick_init(void);
#endif // SYSTICK_H