V1.0
This commit is contained in:
		@ -1,9 +0,0 @@
 | 
			
		||||
#ifndef INC_PWM_CONTROL_H_
 | 
			
		||||
#define INC_PWM_CONTROL_H_
 | 
			
		||||
 | 
			
		||||
#include "stm32f3xx_hal_conf.h"
 | 
			
		||||
 | 
			
		||||
void PWMControl_UpdatePWMs(uint8_t pwrgndfans );
 | 
			
		||||
void PWMControl_init(TIM_HandleTypeDef* timer3);
 | 
			
		||||
 | 
			
		||||
#endif /* INC_CHANNEL_CONTROL_H_ */
 | 
			
		||||
@ -25,9 +25,9 @@ CCR: 1/20 -> 500, 2/20 -> 1000
 | 
			
		||||
 | 
			
		||||
//#define BATTERY_COOLING_FREQ        20000
 | 
			
		||||
 | 
			
		||||
void PWM_control_init(TIM_HandleTypeDef* powerground, TIM_HandleTypeDef* battery_cooling);
 | 
			
		||||
 | 
			
		||||
void PWM_control_init(TIM_HandleTypeDef* pg, TIM_HandleTypeDef* bat_cool, TIM_HandleTypeDef* esc_cool);
 | 
			
		||||
void PWM_powerground_control(uint8_t percent);
 | 
			
		||||
void PWM_battery_cooling_control(uint8_t percent);
 | 
			
		||||
void PWM_esc_cooling(uint8_t percent);
 | 
			
		||||
 | 
			
		||||
#endif /* INC_CHANNEL_CONTROL_H */
 | 
			
		||||
 | 
			
		||||
@ -1,64 +0,0 @@
 | 
			
		||||
#ifndef CAN_HALAL_H
 | 
			
		||||
#define CAN_HALAL_H
 | 
			
		||||
 | 
			
		||||
// Define family macros if none are defined and we recognize a chip macro
 | 
			
		||||
#if !defined(STM32F3) && !defined(STM32H7)
 | 
			
		||||
#if defined(STM32F302x6) || defined(STM32F302x8) || defined(STM32F302xB) ||    \
 | 
			
		||||
    defined(STM32F302xC)
 | 
			
		||||
#define STM32F3
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(STM32H7A3xx)
 | 
			
		||||
#define STM32H7
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(STM32F3)
 | 
			
		||||
#include "stm32f3xx_hal.h"
 | 
			
		||||
#define FTCAN_IS_BXCAN
 | 
			
		||||
#define FTCAN_NUM_FILTERS 13
 | 
			
		||||
#elif defined(STM32H7)
 | 
			
		||||
#include "stm32h7xx_hal.h"
 | 
			
		||||
#define FTCAN_IS_FDCAN
 | 
			
		||||
#ifndef FTCAN_NUM_FILTERS
 | 
			
		||||
    #error "Please configure the number of filters in CubeMX, and then add a compiler define for FTCAN_NUM_FILTERS"
 | 
			
		||||
#endif
 | 
			
		||||
#else
 | 
			
		||||
#error "Couldn't detect STM family"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#if defined(FTCAN_IS_BXCAN)
 | 
			
		||||
HAL_StatusTypeDef ftcan_init(CAN_HandleTypeDef *handle);
 | 
			
		||||
#elif defined(FTCAN_IS_FDCAN)
 | 
			
		||||
HAL_StatusTypeDef ftcan_init(FDCAN_HandleTypeDef *handle);
 | 
			
		||||
#else
 | 
			
		||||
#error "Unknown CAN peripheral"
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
HAL_StatusTypeDef ftcan_transmit(uint16_t id, const uint8_t *data,
 | 
			
		||||
                                 size_t datalen);
 | 
			
		||||
 | 
			
		||||
HAL_StatusTypeDef ftcan_add_filter(uint16_t id, uint16_t mask);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Define this function to be notified of incoming CAN messages
 | 
			
		||||
 */
 | 
			
		||||
void ftcan_msg_received_cb(uint16_t id, size_t datalen, const uint8_t *data);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Read num_bytes bytes from a message (unmarshalled network byte order). The
 | 
			
		||||
 * msg pointer is advanced by the corresponding number of bytes.
 | 
			
		||||
 *
 | 
			
		||||
 * Both methods return a 64-bit integer, but you can safely cast it to a smaller
 | 
			
		||||
 * integer type.
 | 
			
		||||
 */
 | 
			
		||||
uint64_t ftcan_unmarshal_unsigned(const uint8_t **data, size_t num_bytes);
 | 
			
		||||
int64_t ftcan_unmarshal_signed(const uint8_t **data, size_t num_bytes);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Write num_bytes to a message (marshalled in network byte order). The pointer
 | 
			
		||||
 * is advanced by the corresponding number of bytes and returned.
 | 
			
		||||
 */
 | 
			
		||||
uint8_t *ftcan_marshal_unsigned(uint8_t *data, uint64_t val, size_t num_bytes);
 | 
			
		||||
uint8_t *ftcan_marshal_signed(uint8_t *data, int64_t val, size_t num_bytes);
 | 
			
		||||
 | 
			
		||||
#endif // CAN_HALAL_H
 | 
			
		||||
@ -59,28 +59,40 @@ void Error_Handler(void);
 | 
			
		||||
/* USER CODE END EFP */
 | 
			
		||||
 | 
			
		||||
/* Private defines -----------------------------------------------------------*/
 | 
			
		||||
#define RELAY_EN_Pin GPIO_PIN_0
 | 
			
		||||
#define RELAY_EN_GPIO_Port GPIOA
 | 
			
		||||
#define _60V_EN_Pin GPIO_PIN_1
 | 
			
		||||
#define _60V_EN_GPIO_Port GPIOA
 | 
			
		||||
#define CSB_Pin GPIO_PIN_4
 | 
			
		||||
#define CSB_GPIO_Port GPIOA
 | 
			
		||||
#define STATUS_LED_R_Pin GPIO_PIN_0
 | 
			
		||||
#define ESC_L_PWM_Pin GPIO_PIN_0
 | 
			
		||||
#define ESC_L_PWM_GPIO_Port GPIOB
 | 
			
		||||
#define ESC_R_PWM_Pin GPIO_PIN_1
 | 
			
		||||
#define ESC_R_PWM_GPIO_Port GPIOB
 | 
			
		||||
#define BAT_COOLING_PWM_Pin GPIO_PIN_10
 | 
			
		||||
#define BAT_COOLING_PWM_GPIO_Port GPIOB
 | 
			
		||||
#define BAT_COOLING_ENABLE_Pin GPIO_PIN_11
 | 
			
		||||
#define BAT_COOLING_ENABLE_GPIO_Port GPIOB
 | 
			
		||||
#define ESC_COOLING_ENABLE_Pin GPIO_PIN_14
 | 
			
		||||
#define ESC_COOLING_ENABLE_GPIO_Port GPIOB
 | 
			
		||||
#define ESC_COOLING_PWM_Pin GPIO_PIN_15
 | 
			
		||||
#define ESC_COOLING_PWM_GPIO_Port GPIOB
 | 
			
		||||
#define EEPROM___WC__Pin GPIO_PIN_8
 | 
			
		||||
#define EEPROM___WC__GPIO_Port GPIOA
 | 
			
		||||
#define EEPROM_SCL_Pin GPIO_PIN_9
 | 
			
		||||
#define EEPROM_SCL_GPIO_Port GPIOA
 | 
			
		||||
#define EEPROM_SDA_Pin GPIO_PIN_10
 | 
			
		||||
#define EEPROM_SDA_GPIO_Port GPIOA
 | 
			
		||||
#define TMP_SCL_Pin GPIO_PIN_15
 | 
			
		||||
#define TMP_SCL_GPIO_Port GPIOA
 | 
			
		||||
#define RELAY_ENABLE_Pin GPIO_PIN_4
 | 
			
		||||
#define RELAY_ENABLE_GPIO_Port GPIOB
 | 
			
		||||
#define PRECHARGE_ENABLE_Pin GPIO_PIN_5
 | 
			
		||||
#define PRECHARGE_ENABLE_GPIO_Port GPIOB
 | 
			
		||||
#define STATUS_LED_R_Pin GPIO_PIN_6
 | 
			
		||||
#define STATUS_LED_R_GPIO_Port GPIOB
 | 
			
		||||
#define STATUS_LED_B_Pin GPIO_PIN_1
 | 
			
		||||
#define STATUS_LED_B_GPIO_Port GPIOB
 | 
			
		||||
#define STATUS_LED_G_Pin GPIO_PIN_2
 | 
			
		||||
#define STATUS_LED_G_Pin GPIO_PIN_7
 | 
			
		||||
#define STATUS_LED_G_GPIO_Port GPIOB
 | 
			
		||||
#define PRECHARGE_EN_Pin GPIO_PIN_11
 | 
			
		||||
#define PRECHARGE_EN_GPIO_Port GPIOB
 | 
			
		||||
#define PWM_Battery_Cooling_Pin GPIO_PIN_15
 | 
			
		||||
#define PWM_Battery_Cooling_GPIO_Port GPIOB
 | 
			
		||||
#define RELAY_BATT_SIDE_ON_Pin GPIO_PIN_8
 | 
			
		||||
#define RELAY_BATT_SIDE_ON_GPIO_Port GPIOA
 | 
			
		||||
#define RELAY_ESC_SIDE_ON_Pin GPIO_PIN_9
 | 
			
		||||
#define RELAY_ESC_SIDE_ON_GPIO_Port GPIOA
 | 
			
		||||
#define CURRENT_SENSOR_ON_Pin GPIO_PIN_10
 | 
			
		||||
#define CURRENT_SENSOR_ON_GPIO_Port GPIOA
 | 
			
		||||
#define STATUS_LED_B_Pin GPIO_PIN_8
 | 
			
		||||
#define STATUS_LED_B_GPIO_Port GPIOB
 | 
			
		||||
#define TMP_SDA_Pin GPIO_PIN_9
 | 
			
		||||
#define TMP_SDA_GPIO_Port GPIOB
 | 
			
		||||
 | 
			
		||||
/* USER CODE BEGIN Private defines */
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -58,7 +58,7 @@
 | 
			
		||||
/*#define HAL_RTC_MODULE_ENABLED   */
 | 
			
		||||
#define HAL_SPI_MODULE_ENABLED
 | 
			
		||||
#define HAL_TIM_MODULE_ENABLED
 | 
			
		||||
#define HAL_UART_MODULE_ENABLED
 | 
			
		||||
/*#define HAL_UART_MODULE_ENABLED   */
 | 
			
		||||
/*#define HAL_USART_MODULE_ENABLED   */
 | 
			
		||||
/*#define HAL_IRDA_MODULE_ENABLED   */
 | 
			
		||||
/*#define HAL_SMARTCARD_MODULE_ENABLED   */
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user