From 82e38738a4d532cc3d56cbf80c1a4093f23cdd6a Mon Sep 17 00:00:00 2001
From: tao_z <tzj0429@163.com>
Date: Wed, 14 Jul 2021 07:01:42 +0800
Subject: [PATCH] 调整时钟64MHz。 RTT任务增加马达开启和关闭功能

---
 USR/INC/pwm.h |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/USR/INC/pwm.h b/USR/INC/pwm.h
index f4d2e75..5be01f7 100644
--- a/USR/INC/pwm.h
+++ b/USR/INC/pwm.h
@@ -1,13 +1,21 @@
 #ifndef _PWM_H_
 #define _PWM_H_
 #include "gd32e23x_timer.h"
-//1us * 10000 = 10ms
-#define PERIOD_CAP (10000lU)
+//1us * 30000 = 30ms
+#define PERIOD_CAP (30000U)
+#define SPEED_TIMEOUT (300U) //9S
 
-//48Mzhz / 3000 = 16Khz = 62.5us
-#define PERIOD_CMP (3000u)
+//64Mzhz / 3200 = 20Khz = 50us
+#define PERIOD_CMP (3200u)
+#define TIMER2_PERIOD (63U)
 
 void TimerInit(void);
 void SetPwmDuty(uint16_t ch, uint32_t duty);
 void SetPwmPeriod(uint32_t period);
+
+extern void StartSpeedTime(void);
+extern void StopSpeedTime(void);
+extern void stop_pwm_output(void);
+extern void TIMER2_IRQHandler_CallBack(void);
+extern uint32_t GetSpeedTimerOutcnt(void);
 #endif

--
Gitblit v1.8.0