添加串口操作类
Some checks failed
Build and Upload Artifact / build and upload-artifact (push) Failing after 13s

This commit is contained in:
chauyin
2025-05-06 22:34:51 +08:00
parent 2018adcf78
commit c7a965ed3c
18 changed files with 22698 additions and 30 deletions

View 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);
}
}