This commit is contained in:
hamza
2024-07-10 09:59:34 +03:00
parent 4e33934b15
commit 662faed1fe
5 changed files with 57 additions and 32 deletions

View File

@ -9,10 +9,7 @@
#define INC_PWM_CONTROL_H
#include "stm32f3xx_hal.h"
#include "ADBMS_LL_Driver.h"
#include "state_machine.h"
#include <stdint.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.
@ -28,13 +25,21 @@ DUTY CYCLE = 1/20 -> 0%, DUTY CYCLE = 2/20 -> 100%
CCR * DUTY_CYCLE
CCR: 1/20 -> 500, 2/20 -> 1000
*/
// UNUSED
#define POWERGROUND_FREQ 50
#define POWERGROUND_PRESCALER 7
#define POWERGROUND_ARR 39999
#define POWERGROUND_MIN_DUTY_CYCLE 0.05
#define POWERGROUND_MAX_DUTY_CYCLE 0.1
//#define BATTERY_COOLING_FREQ 20000
extern uint8_t current_powerground_status;
extern uint8_t target_powerground_status;
void PWM_control_init(TIM_HandleTypeDef* pg, TIM_HandleTypeDef* bat_cool, TIM_HandleTypeDef* esc_cool);
void PWM_powerground_softcontrol();
void PWM_powerground_control(uint8_t percent);
void PWM_battery_cooling_control(uint8_t percent);
void PWM_set_throttle();
#endif /* INC_CHANNEL_CONTROL_H */