From d9e728e0060b24c411c84aa2eaff60defea7f266 Mon Sep 17 00:00:00 2001 From: shentou Date: Thu, 4 Dec 2025 17:58:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E4=B8=80=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- Core/Src/main.c | 68 ------------------------------------------------- 2 files changed, 2 insertions(+), 69 deletions(-) diff --git a/.gitignore b/.gitignore index 567609b..65af97a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -build/ +/build +/.cache diff --git a/Core/Src/main.c b/Core/Src/main.c index 18e2dc7..f158fe6 100644 --- a/Core/Src/main.c +++ b/Core/Src/main.c @@ -38,79 +38,11 @@ /* Private define ------------------------------------------------------------*/ /* USER CODE BEGIN PD */ -// void frequency_set(uint16_t frequency) -// { -// -// uint16_t perid = 4608000/frequency; -// HRTIM1_TIMA->CMP1xR = 50; -// HRTIM1_TIMA->CMP2xR = perid*0.5f+50; -// HRTIM1_TIMB->CMP1xR = perid*0.5f+50; -// HRTIM1_TIMB->CMP2xR = 50; -// HRTIM1_TIMA->PERxR = perid; -// HRTIM1_TIMB->PERxR = perid; -// -// } -// void inventor_enable() -// { -// HAL_HRTIM_WaveformCounterStart(&hhrtim1,HRTIM_TIMERID_MASTER); -// HAL_HRTIM_WaveformCounterStart(&hhrtim1,HRTIM_TIMERID_TIMER_A); -// HAL_HRTIM_WaveformCounterStart(&hhrtim1,HRTIM_TIMERID_TIMER_B); -// HAL_HRTIM_WaveformOutputStart(&hhrtim1, HRTIM_OUTPUT_TA2); -// HAL_HRTIM_WaveformOutputStart(&hhrtim1, HRTIM_OUTPUT_TB2); -// HAL_GPIO_WritePin(GPIOA, GPIO_PIN_10, 1); -// HAL_GPIO_WritePin(GPIOA, GPIO_PIN_8, 1); -// } /* USER CODE END PD */ /* Private macro -------------------------------------------------------------*/ /* USER CODE BEGIN PM */ -// #define WINDOW_SIZE 2000 -// -// typedef struct { -// float* buffer; -// uint32_t index; -// float sum; -// uint8_t is_full; -// int size; -// } MovingAverageFilter; -// -// // 初始化 -// void MAF_Init(MovingAverageFilter *f) -// { -// for (int i = 0; i < f->size; i++) -// f->buffer[i] = 0.0f; -// -// f->index = 0; -// f->sum = 0.0f; -// f->is_full = 0; -// } -// -// // 输入新数据并返回最新平均值 -// float MAF_Update(MovingAverageFilter *f, float new_value) -// { -// if (f->is_full) { -// // 删除最旧值 -// f->sum -= f->buffer[f->index]; -// } -// -// // 写入新值 -// f->buffer[f->index] = new_value; -// f->sum += new_value; -// -// f->index++; -// if (f->index >= f->size) { -// f->index = 0; -// f->is_full = 1; // 表示缓冲区装满了 -// } -// -// // 未满时平均值 = sum / 已填入的数量 -// if (!f->is_full) -// return f->sum / (float)f->index; -// -// // 满了以后标准滑动平均 -// return f->sum / f->size; -// } /* USER CODE END PM */ /* Private variables ---------------------------------------------------------*/