添加串口操作类
Some checks failed
Build and Upload Artifact / build and upload-artifact (push) Failing after 13s
Some checks failed
Build and Upload Artifact / build and upload-artifact (push) Failing after 13s
This commit is contained in:
29
Core/App/Helper/delay_helper.c
Normal file
29
Core/App/Helper/delay_helper.c
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// Created by Engineer on 2024/1/11.
|
||||
//
|
||||
|
||||
#include "delay_helper.h"
|
||||
|
||||
#include "tim.h"
|
||||
|
||||
void DelaySetup(void) {
|
||||
HAL_TIM_Base_Start(&TIM_DELAY);
|
||||
}
|
||||
|
||||
void DelayUs(const uint16_t nus) {
|
||||
__HAL_TIM_SET_COUNTER(&TIM_DELAY, 0);
|
||||
while (__HAL_TIM_GET_COUNTER(&TIM_DELAY) < nus) {
|
||||
}
|
||||
}
|
||||
|
||||
void DelayMs(const uint32_t nms) {
|
||||
for (uint32_t i = 0; i < nms; ++i) {
|
||||
DelayUs(1000);
|
||||
}
|
||||
}
|
||||
|
||||
void DelayS(const uint32_t ns) {
|
||||
for (uint32_t i = 0; i < ns; ++i) {
|
||||
DelayMs(1000);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user