feat:新建项目文件

BLV主机C1P模块
This commit is contained in:
caocong
2025-12-06 13:49:01 +08:00
commit d2d8800788
118 changed files with 47572 additions and 0 deletions

51
MCU_Driver/timer.c Normal file
View File

@@ -0,0 +1,51 @@
/*
* timer.c
*
* Created on: May 16, 2025
* Author: cc
*/
#include "timer.h"
#include <stdio.h>
#include <string.h>
void TIMER0_Init(void)
{
TMR0_DeInit();
TMR0_TimerInit(SystemCoreClock / 10000);
TMR0_ITCfg(RB_TMR_IF_CYC_END, ENABLE);
NVIC_EnableIRQ(TIM0_IRQn);
TMR0_Enable();
}
volatile uint32_t Time0_100us = 0;
volatile uint32_t Time0_1ms = 0;
void __attribute__((interrupt("WCH-Interrupt-fast"))) TIM0_IRQHandler()
{
static uint8_t NUM_1 = 0;
TMR0_ClearITFlag(RB_TMR_IF_CYC_END);
Time0_100us++;
NUM_1++;
if(NUM_1 >= 10){
NUM_1 = 0;
Time0_1ms++;
}
}
void Timer0_Task(void)
{
static uint32_t timer0_tick = 0;
if(Time0_1ms - timer0_tick >= 1000 ){
timer0_tick = Time0_1ms;
printf("Run:%d ..",timer0_tick);
}
}