global refactoring
This commit is contained in:
@@ -8,6 +8,21 @@
|
||||
#ifndef INC_CHARGER_GBT_H_
|
||||
#define INC_CHARGER_GBT_H_
|
||||
#include "main.h"
|
||||
#include "connector.h"
|
||||
|
||||
#define GBT_CST_NO_REASON 0x0000F0F0
|
||||
#define GBT_CST_CONDITION_REACHED 0x0100F0F0 // заряд завершен
|
||||
#define GBT_CST_SUSPENDS_ARTIFICIALLY 0x0400F0F0
|
||||
#define GBT_CST_FAULT_SUSPENSION 0x1000F0F0
|
||||
#define GBT_CST_BMS_ACTIVELY_SUSPENDS 0x4000F0F0 //завершение по инициативе BMS
|
||||
#define GBT_CST_CONNECTOR_OVER_TEMP 0x0001F0F0
|
||||
#define GBT_CST_INT_PART_OVER_TEMP 0x0010F0F0
|
||||
#define GBT_CST_CANNOT_SUPPLY_REQ_ELQ 0x0040F0F0
|
||||
#define GBT_CST_SUDDENSTOP 0x0000F1F0
|
||||
#define GBT_CST_OTHERFALUT 0x0000F4F0
|
||||
#define GBT_CST_CURRENT_MISMATCH 0x0000F0F1
|
||||
#define GBT_CST_ABNORMALVOLTAGEERROR 0x0000F0F4
|
||||
|
||||
|
||||
typedef enum{
|
||||
GBT_CC_UNKNOWN,
|
||||
@@ -19,20 +34,22 @@ typedef enum{
|
||||
}gbtCcState_t;
|
||||
|
||||
typedef enum{
|
||||
GBT_DISABLED,
|
||||
GBT_S0_UNCONNECTED, //СС1 12V/6V СС2 12V
|
||||
GBT_S1_CONNECTED, //СС1 4V СС2 4V (6V)
|
||||
GBT_S2_LOCKED, //
|
||||
GBT_S3_STARTED, // 12V AUX
|
||||
GBT_S4_ISOTEST, // testing isolation, send CHM receive BHM
|
||||
GBT_S5_BAT_INFO, // identifying BMS, send CRM receive BRM (long)
|
||||
GBT_S6_BAT_STAT, // send CRM(AA), receive BCP (long)
|
||||
GBT_S7_BMS_WAIT, // wait for BMS, send CTS+CML receive BRO(00), next BRO(AA)
|
||||
GBT_S8_INIT_CHARGER,// starting power modules, send CRO(00)
|
||||
GBT_S9_WAIT_BCL, // waiting for BCL (requested voltage), send CRO(00)
|
||||
GBT_S10_CHARGING, // charging, contactor ON, send CCS, receiving BCL+BCS+BSM
|
||||
GBT_STOP, // stop
|
||||
//TODO: after stop send BSD state
|
||||
GBT_DISABLED = 0x10,
|
||||
// GBT_S0_UNCONNECTED = 0x10, //СС1 12V/6V СС2 12V
|
||||
// GBT_S1_CONNECTED = 0x11, //СС1 4V СС2 4V (6V)
|
||||
// GBT_S2_LOCKED = 0x12, //
|
||||
GBT_S3_STARTED = 0x13, // 12V AUX
|
||||
GBT_S4_ISOTEST = 0x14, // testing isolation, send CHM receive BHM
|
||||
GBT_S5_BAT_INFO = 0x15, // identifying BMS, send CRM receive BRM (long)
|
||||
GBT_S6_BAT_STAT = 0x16, // send CRM(AA), receive BCP (long)
|
||||
GBT_S7_BMS_WAIT = 0x17, // wait for BMS, send CTS+CML receive BRO(00), next BRO(AA)
|
||||
GBT_S8_INIT_CHARGER = 0x18,// starting power modules, send CRO(00)
|
||||
GBT_S9_WAIT_BCL = 0x19, // waiting for BCL (requested voltage), send CRO(00)
|
||||
GBT_S10_CHARGING = 0x20, // charging, contactor ON, send CCS, receiving BCL+BCS+BSM
|
||||
GBT_STOP = 0x21, // normal stop
|
||||
GBT_STOP_CSD = 0x22, // normal stop
|
||||
GBT_ERROR = 0x23, // Error
|
||||
GBT_COMPLETE = 0x24,
|
||||
|
||||
}gbtState_t;
|
||||
|
||||
@@ -46,7 +63,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
uint8_t bmsIdentified;
|
||||
char chargerNumber[4];
|
||||
uint32_t chargerNumber;
|
||||
char chargerLocation[3];
|
||||
}GBT_CRM_t;
|
||||
|
||||
@@ -124,6 +141,12 @@ typedef struct {
|
||||
|
||||
}GBT_CCS_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t chargingTime;
|
||||
uint16_t outputEnergy;
|
||||
uint32_t chargerNumber;
|
||||
}GBT_CSD_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t enablePSU;
|
||||
@@ -135,6 +158,9 @@ typedef struct {
|
||||
uint16_t chargingElapsedTimeMin; //
|
||||
uint8_t chargingElapsedTimeSec; //
|
||||
|
||||
CONN_State_t connectorState;
|
||||
|
||||
|
||||
}GBT_EDCAN_Output_t;
|
||||
|
||||
typedef struct {
|
||||
@@ -142,9 +168,11 @@ typedef struct {
|
||||
uint16_t measuredVoltage; // 0.1V/bit
|
||||
uint16_t measuredCurrent; // 0.1A/bit
|
||||
|
||||
CONN_Control_t chargeControl;
|
||||
|
||||
}GBT_EDCAN_Input_t;
|
||||
|
||||
|
||||
/* 500 - Power Supply
|
||||
TX
|
||||
* PSU_ENABLE
|
||||
@@ -170,6 +198,8 @@ RX
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
extern gbtState_t GBT_State;
|
||||
|
||||
extern ADC_HandleTypeDef hadc1;
|
||||
|
||||
extern GBT_BRM_t GBT_EVInfo;
|
||||
@@ -180,30 +210,38 @@ extern GBT_CML_t GBT_MaxLoad;
|
||||
extern GBT_CCS_t GBT_ChargerCurrentStatus;
|
||||
extern GBT_CRM_t GBT_ChargerInfo;
|
||||
extern GBT_BSM_t GBT_BatteryStatus;
|
||||
extern GBT_CSD_t GBT_ChargerStop;
|
||||
|
||||
extern uint8_t GBT_BRO;
|
||||
|
||||
extern uint8_t GBT_Charger_Enable;
|
||||
|
||||
void GBT_Init();
|
||||
void GBT_Start();
|
||||
void GBT_Stop();
|
||||
void GBT_Stop1();
|
||||
void GBT_Reset();
|
||||
void GBT_Stop(uint32_t causecode);
|
||||
void GBT_ForceStop();
|
||||
void GBT_ChargerTask();
|
||||
float GBT_CC_GetAdc();
|
||||
void ADC_Select_Channel(uint32_t ch);
|
||||
uint8_t GBT_CC_GetState();
|
||||
void GBT_Error(uint32_t errorcode);
|
||||
|
||||
//float GBT_CC_GetAdc();
|
||||
|
||||
//uint8_t GBT_CC_GetState();
|
||||
|
||||
void GBT_SwitchState(gbtState_t state);
|
||||
void GBT_Delay(uint32_t delay);
|
||||
uint32_t GBT_StateTick();
|
||||
void J_SendPacket(uint32_t PGN, uint8_t pri, uint8_t DLC, uint8_t *data);
|
||||
|
||||
void GBT_SendCCS();
|
||||
void GBT_SendCST();
|
||||
void GBT_SendCST(uint32_t Cause);
|
||||
void GBT_SendCRO(uint8_t state);
|
||||
void GBT_SendCML();
|
||||
void GBT_SendCTS();
|
||||
void GBT_SendCHM();
|
||||
void GBT_SendCRM(uint8_t state);
|
||||
|
||||
void GBT_SendCSD();
|
||||
void GBT_SendCEM(uint32_t ErrorCode);
|
||||
|
||||
|
||||
#endif /* INC_CHARGER_GBT_H_ */
|
||||
|
||||
Reference in New Issue
Block a user