Initial commit
This commit is contained in:
22
FW/Core/my_src/delay.c
Normal file
22
FW/Core/my_src/delay.c
Normal file
@@ -0,0 +1,22 @@
|
||||
#include "stm32h7xx.h"
|
||||
#include "stm32h7xx_ll_tim.h"
|
||||
|
||||
void delay_us(unsigned int nus)
|
||||
{
|
||||
LL_TIM_SetCounter(TIM6,0);
|
||||
LL_TIM_SetAutoReload(TIM6,(10*nus-1));
|
||||
LL_TIM_EnableCounter(TIM6);
|
||||
while(!(LL_TIM_IsActiveFlag_UPDATE(TIM6))){
|
||||
;
|
||||
}
|
||||
LL_TIM_ClearFlag_UPDATE(TIM6);
|
||||
LL_TIM_DisableCounter(TIM6);
|
||||
}
|
||||
|
||||
void delay_ms(unsigned int nms)
|
||||
{
|
||||
unsigned int i = 0;
|
||||
for(i=0;i<nms;i++){
|
||||
delay_us(1000);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user