89 lines
2.1 KiB
C
89 lines
2.1 KiB
C
#ifndef BMS_BMU_H_
|
||
#define BMS_BMU_H_
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
#include "bsp_can.h"
|
||
#include "kit_macro.h"
|
||
#include "table_comm.h"
|
||
#include "bmu_comm_data.h"
|
||
|
||
|
||
|
||
#define BCU_REQ_BMU_INFO_ID (0x180011F4u)
|
||
|
||
#define BMU_STAT_HIGH_TEMPERATURE_NUM 3 // <20><><EFBFBD><EFBFBD>¶<EFBFBD>ͳ<EFBFBD>Ƹ<EFBFBD><C6B8><EFBFBD>
|
||
#define BMU_STAT_LOW_TEMPERATURE_NUM 3 // <20><><EFBFBD><EFBFBD>¶<EFBFBD>ͳ<EFBFBD>Ƹ<EFBFBD><C6B8><EFBFBD>
|
||
#define BMU_STAT_HIGH_VOLTAGE_NUM 3 // <20><>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD>ѹͳ<D1B9>Ƹ<EFBFBD><C6B8><EFBFBD>
|
||
#define BMU_STAT_LOW_VOLTAGE_NUM 3 // <20><>͵<EFBFBD><CDB5><EFBFBD><EFBFBD>ѹͳ<D1B9>Ƹ<EFBFBD><C6B8><EFBFBD>
|
||
|
||
|
||
|
||
|
||
typedef struct
|
||
{
|
||
uint8_t bmu_id;
|
||
uint8_t index;
|
||
uint16_t temperature;
|
||
}BmuTemperatureItem;
|
||
|
||
typedef struct
|
||
{
|
||
uint8_t bmu_id;
|
||
uint8_t index;
|
||
uint16_t voltage;
|
||
}BmuVoltageItem;
|
||
|
||
#define MOVE_RIGHT(ITEMS, NUM, START) \
|
||
do{ \
|
||
if (NUM < 2) break; \
|
||
pos = (NUM - 1) - 1; \
|
||
while (pos >= START) \
|
||
{ \
|
||
ITEMS[pos + 1] = ITEMS[pos]; \
|
||
if (pos == 0) break;\
|
||
--pos; \
|
||
} \
|
||
}while(0)
|
||
|
||
|
||
bool bms_is_bmu_online(uint8_t bmu_idx);
|
||
|
||
//void bms_set_bmu_step(BmuStep step);
|
||
|
||
bool bms_is_fan_open(uint8_t bmu_idx);
|
||
void bms_set_fan_status(uint8_t bmu_idx, bool is_on);
|
||
|
||
void bms_handle_bmu_info_msg(void);
|
||
|
||
uint8_t bms_get_bmu_num(void);
|
||
uint8_t bms_get_bmu_online_num(void);
|
||
uint64_t bms_get_bmu_fault_bit(BmuFaultBit idx);
|
||
|
||
uint16_t bms_get_cell_num(void);
|
||
uint16_t bms_get_temp_num(void);
|
||
uint16_t bms_get_cell_volt(uint16_t idx);
|
||
uint16_t bms_get_cell_temp(uint16_t idx);
|
||
uint32_t bms_get_cell_volt_buf_addr(void);
|
||
uint32_t bms_get_cell_temp_buf_addr(void);
|
||
|
||
uint16_t bms_get_bmu_data(uint8_t bmu_idx, BmuData data);
|
||
uint32_t bms_get_bmu_statistic_data(uint8_t bmu_idx, BmuStatisticData idx);
|
||
|
||
uint16_t bms_get_cell_volt_by_bmu(uint8_t bmu_idx, uint16_t idx);
|
||
uint16_t bms_get_cell_temp_by_bmu(uint8_t bmu_idx, uint16_t idx);
|
||
uint16_t bms_get_pole_temp_by_bmu(uint8_t bmu_idx, uint16_t idx);
|
||
uint16_t bms_get_balance_temp_by_bmu(uint8_t bmu_idx, uint16_t idx);
|
||
uint32_t bms_get_balance_status(uint8_t bmu_idx, uint8_t idx);
|
||
|
||
void bms_set_bmu_fault_bit(BmuFaultBit idx,uint8_t value);
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif
|
||
|