first commit
This commit is contained in:
22
APP/delay.c
Normal file
22
APP/delay.c
Normal file
@ -0,0 +1,22 @@
|
||||
//
|
||||
// Created by IRIS on 25-2-10.
|
||||
//
|
||||
|
||||
#include "delay.h"
|
||||
|
||||
void Delay_Init() {
|
||||
HAL_TIM_Base_Start(&htim5); //启动定时器
|
||||
}
|
||||
|
||||
void Delay_us(uint32_t us) {
|
||||
|
||||
uint32_t Time_Now;
|
||||
uint32_t Ts;
|
||||
|
||||
__HAL_TIM_SetCounter(&htim5, 0);
|
||||
while(Ts < us) {
|
||||
Time_Now = __HAL_TIM_GET_COUNTER(&htim5);
|
||||
Ts = Time_Now * 0.1;
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user