added PWM_powerground_control()
moved pg2 to TIM15CH2
This commit is contained in:
		@ -5,6 +5,24 @@
 | 
			
		||||
#include "ADBMS_LL_Driver.h"
 | 
			
		||||
#include "main.h"
 | 
			
		||||
 | 
			
		||||
/*  The PWM period (1/FPWM) is defined by the following parameters: 
 | 
			
		||||
ARR value, the Prescaler value, and the internal clock itself which drives the timer module FCLK.
 | 
			
		||||
F_PWM = (F_CLK)/((ARR + 1) * (PSC + 1))
 | 
			
		||||
 | 
			
		||||
F_CLK = 16 MHz
 | 
			
		||||
 | 
			
		||||
POWERGROUND ESC Signal: pulse every 20 ms, 1 ms = 0%, 2 ms = 100%
 | 
			
		||||
FREQ = 50 Hz -> 16 MHz/50 Hz = 320000 = ((9999 + 1) * (31 + 1))
 | 
			
		||||
DUTY CYCLE = 1/20 -> 0%, DUTY CYCLE = 2/20 -> 100% 
 | 
			
		||||
CCR * DUTY_CYCLE
 | 
			
		||||
CCR: 1/20 -> 500, 2/20 -> 1000
 | 
			
		||||
*/
 | 
			
		||||
#define POWERGROUND_FREQ            50
 | 
			
		||||
#define POWERGROUND_MAX_DUTY_CYCLE  0.05
 | 
			
		||||
#define POWERGROUND_MIN_DUTY_CYCLE  0.1
 | 
			
		||||
 | 
			
		||||
//#define BATTERY_COOLING_FREQ        20000
 | 
			
		||||
 | 
			
		||||
void PWM_control_init(TIM_HandleTypeDef powerground1, TIM_HandleTypeDef powerground2, TIM_HandleTypeDef battery_cooling);
 | 
			
		||||
 | 
			
		||||
void PWM_powerground_control(uint8_t percent);
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user