From a6cb521d712ae522c0fe170d6c5378498515e9e9 Mon Sep 17 00:00:00 2001 From: cirry <812852553@qq.com> Date: Fri, 14 Aug 2026 01:10:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9A=E6=97=B6=E5=99=A8=E5=86=99=E4=BA=86?= =?UTF-8?q?=E4=B8=80=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BSP/Timer.c | 1 + BSP/Timer.h | 4 ++++ CMakeLists.txt | 4 +++- User/main.c | 8 +------- 4 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 BSP/Timer.c create mode 100644 BSP/Timer.h diff --git a/BSP/Timer.c b/BSP/Timer.c new file mode 100644 index 0000000..b01a305 --- /dev/null +++ b/BSP/Timer.c @@ -0,0 +1 @@ +#include "stm32f10x.h" \ No newline at end of file diff --git a/BSP/Timer.h b/BSP/Timer.h new file mode 100644 index 0000000..c13a271 --- /dev/null +++ b/BSP/Timer.h @@ -0,0 +1,4 @@ +#ifndef __TIMER_H +#define __TIMER_H + +#endif diff --git a/CMakeLists.txt b/CMakeLists.txt index eaa2c19..b5ef35f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,9 @@ add_executable(${CMAKE_PROJECT_NAME} BSP/CountSensor.h BSP/Encoder.c BSP/Encoder.h -) + BSP/Timer.c + BSP/Timer.h +) target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE CMSIS # stm32f10x.h, core_cm3.h, system_stm32f10x.h diff --git a/User/main.c b/User/main.c index c024cc9..04cf074 100644 --- a/User/main.c +++ b/User/main.c @@ -7,15 +7,9 @@ int16_t Num = 0; int main(void) { OLED_Init(); - Encoder_Init(); - OLED_ShowString(1, 1, "Num:"); - + OLED_ShowString(1, 1, "Hello World"); while (1) { - OLED_ShowNum(2, 1, GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_0), 1); // 显示 PB0 电平 - OLED_ShowNum(3, 1, GPIO_ReadInputDataBit(GPIOB, GPIO_Pin_1), 1); // 显示 PB1 电平 - Num += GetEncoder_Counter(); - OLED_ShowSignedNum(1, 5, Num, 5); } }