added PWM_control
This commit is contained in:
parent
600d55f292
commit
7133516721
13
Core/Inc/PWM_control.h
Normal file
13
Core/Inc/PWM_control.h
Normal file
@ -0,0 +1,13 @@
|
||||
#ifndef INC_PWM_CONTROL_H_
|
||||
#define INC_PWM_CONTROL_H_
|
||||
|
||||
#include "stm32f3xx_hal.h"
|
||||
#include "ADBMS_LL_Driver.h"
|
||||
#include "main.h"
|
||||
|
||||
void PWM_control_init(TIM_HandleTypeDef powerground1, TIM_HandleTypeDef powerground2, TIM_HandleTypeDef battery_cooling);
|
||||
|
||||
void PWM_powerground_control(uint8_t percent);
|
||||
void PWM_battery_cooling_control(uint8_t percent);
|
||||
|
||||
#endif /* INC_CHANNEL_CONTROL_H_ */
|
30
Core/Src/PWM_control.c
Normal file
30
Core/Src/PWM_control.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include "PWM_control.h"
|
||||
#include "stm32f3xx_hal_tim.h"
|
||||
#include <stdint.h>
|
||||
|
||||
uint8_t powerground_status;
|
||||
uint8_t battery_cooling_status;
|
||||
|
||||
TIM_HandleTypeDef powerground1, powerground2, battery_cooling;
|
||||
|
||||
void PWM_control_init(TIM_HandleTypeDef powerground1, TIM_HandleTypeDef powerground2, TIM_HandleTypeDef battery_cooling){
|
||||
powerground_status = 0;
|
||||
battery_cooling = 0;
|
||||
|
||||
HAL_TIM_PWM_Start(&powerground1, 1);
|
||||
HAL_TIM_PWM_Start(&powerground2, 4);
|
||||
HAL_TIM_PWM_Start(&battery_cooling, 3);
|
||||
|
||||
//__HAL_TIM_SET_COMPARE(&powerground1, 1, 0);
|
||||
//__HAL_TIM_SET_COMPARE(&powerground2, 4, 0);
|
||||
//__HAL_TIM_SET_COMPARE(&battery_cooling, 3, 0);
|
||||
}
|
||||
|
||||
void PWM_powerground_control(uint8_t percent){
|
||||
//uint8_t duty_cycle = (percent/100) * 65536;
|
||||
//__HAL_TIM_SET_COMPARE(&powerground1, 1, 0);
|
||||
}
|
||||
|
||||
void PWM_battery_cooling_control(uint8_t percent){
|
||||
|
||||
}
|
25
Makefile
25
Makefile
@ -1,5 +1,5 @@
|
||||
##########################################################################################################################
|
||||
# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Fri May 24 17:06:04 GMT 2024]
|
||||
# File automatically-generated by tool: [projectgenerator] version: [4.3.0-B58] date: [Fri May 24 17:29:49 GMT 2024]
|
||||
##########################################################################################################################
|
||||
|
||||
# ------------------------------------------------
|
||||
@ -40,7 +40,28 @@ Core/Src/main.c \
|
||||
Core/Src/stm32f3xx_it.c \
|
||||
Core/Src/stm32f3xx_hal_msp.c \
|
||||
Core/Src/sysmem.c \
|
||||
Core/Src/syscalls.c
|
||||
Core/Src/syscalls.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_can.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_rcc_ex.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_gpio.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_dma.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_cortex.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_pwr_ex.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_flash_ex.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_i2c_ex.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_exti.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_spi.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_spi_ex.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_tim_ex.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart.c \
|
||||
Drivers/STM32F3xx_HAL_Driver/Src/stm32f3xx_hal_uart_ex.c \
|
||||
Core/Src/system_stm32f3xx.c
|
||||
|
||||
# ASM sources
|
||||
ASM_SOURCES = \
|
||||
|
Loading…
x
Reference in New Issue
Block a user