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

21
systick.c Normal file
View File

@@ -0,0 +1,21 @@
#include "systick.h"
volatile uint32_t systick_millis;
void systick_init(void) {
SysTick->CTLR = 0x0000;
SysTick->CMP = SysTick->CNT + SYSTICK_ONE_MILLISECOND;
systick_millis = 0;
SysTick->CTLR = SYSTICK_CTLR_STE | // Enable Counter
SYSTICK_CTLR_STIE | // Enable Interrupts
SYSTICK_CTLR_STCLK; // Set Clock Source to HCLK/1
NVIC_EnableIRQ(SysTick_IRQn);
}
void SysTick_Handler(void) __attribute__((interrupt));
void SysTick_Handler(void) {
SysTick->CMP = SysTick->CNT + SYSTICK_ONE_MILLISECOND;
SysTick->SR = 0;
systick_millis++;
}