 #pragma once
// #ifndef	__QINGXIE_BMS_H
// #define __QINGXIE_BMS_H

#include "stm32f1xx_hal.h"
#include "soft_can.h"
#include "common.h"

#define FMU_TO_QINGXIE_ID (0x066B)
#define QINGXIE_BMS0_CAN_ID1 (0x166C)
#define QINGXIE_BMS0_CAN_ID2 (0x166D)
#define QINGXIE_BMS0_CAN_ID3 (0x166E)
#define QINGXIE_BMS1_CAN_ID1 (0x266C)
#define QINGXIE_BMS1_CAN_ID2 (0x266D)
#define QINGXIE_BMS1_CAN_ID3 (0x266E)
#define QINGXIE_BMS2_CAN_ID1 (0x366C)
#define QINGXIE_BMS2_CAN_ID2 (0x366D)
#define QINGXIE_BMS2_CAN_ID3 (0x366E)
#define QINGXIE_BMS3_CAN_ID1 (0x466C)
#define QINGXIE_BMS3_CAN_ID2 (0x466D)
#define QINGXIE_BMS3_CAN_ID3 (0x466E)

#pragma pack(1)
typedef struct {
  uint16_t bat_voltage;        /* 电池电压 0.01V */
  uint16_t servo_current;      /* 电机电流 0.01A */
  uint16_t stack_voltage;      /* 电堆电压 0.01V*/
  uint16_t servo_voltage;      /* 电机电压 0.01V */
  uint16_t bat_refuel_current; /* 电池补能电流 0.01A */
  uint16_t gas_tank_pressure;  /* 气罐压力 0.01Mpa */
  uint16_t pipe_pressure;      /* 管压力 0.01Mpa */
  int16_t pcb_temp;            /* PCB温度 0.01°C */
  int16_t stack_temp;          /* 电堆温度 0.01°C */
  uint8_t work_status;        /* 设备状态 */
  uint16_t falt_status;        /* 故障状态 */
  uint8_t self_chek;           /* 自检状态 */
} qingxie_bms_status_t;
#pragma pack(0)
extern Connect_check _qx_bms_link[4];
extern Connect_check _Aqx_bms_link;
extern qingxie_bms_status_t _qx_bms[4];
void QxBmsCanRecvHookFunction(uint32_t id, uint8_t data[], uint8_t len);
void send_info_to_Qx(void);

// #endif
