tao_z
2021-07-14 82e38738a4d532cc3d56cbf80c1a4093f23cdd6a
USR/INC/pwm.h
@@ -1,11 +1,13 @@
#ifndef _PWM_H_
#define _PWM_H_
#include "gd32e23x_timer.h"
//100us * 30000 = 3s
//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);