forked from achamaikin/CCSModuleSW30Web
latest version
This commit is contained in:
@@ -7,8 +7,11 @@
|
||||
|
||||
#ifndef INC_CHARGER_GBT_H_
|
||||
#define INC_CHARGER_GBT_H_
|
||||
|
||||
#include "main.h"
|
||||
#include "connector.h"
|
||||
#include "charger_control.h"
|
||||
|
||||
|
||||
#define GBT_CST_NO_REASON 0x0000F0F0 // Без причины
|
||||
#define GBT_CST_CONDITION_REACHED 0x0100F0F0 // Заряд завершен
|
||||
@@ -23,6 +26,13 @@
|
||||
#define GBT_CST_CURRENT_MISMATCH 0x0000F0F1 // Неправильный ток
|
||||
#define GBT_CST_ABNORMALVOLTAGEERROR 0x0000F0F4 // Ненормальное напряжение
|
||||
|
||||
typedef enum {
|
||||
GBT_STOP_EVSE = 0,
|
||||
GBT_STOP_EV = 1,
|
||||
GBT_STOP_OCPP = 2,
|
||||
|
||||
}GBT_StopSource_t;
|
||||
|
||||
|
||||
typedef enum{
|
||||
GBT_CC_UNKNOWN,
|
||||
@@ -40,26 +50,23 @@ typedef enum{
|
||||
// GBT_S2_LOCKED = 0x12, //
|
||||
GBT_S3_STARTED = 0x13, // 12V AUX
|
||||
GBT_S31_WAIT_BHM = 0x14, // testing isolation, send CHM receive BHM
|
||||
GBT_S4_ISOTEST = 0x15, // testing isolation, send CHM receive BHM
|
||||
GBT_S5_BAT_INFO = 0x16, // identifying BMS, send CRM receive BRM (long)
|
||||
GBT_S6_BAT_STAT = 0x17, // send CRM(AA), receive BCP (long)
|
||||
GBT_S7_BMS_WAIT = 0x18, // wait for BMS, send CTS+CML receive BRO(00), next BRO(AA)
|
||||
GBT_S8_INIT_CHARGER = 0x19,// starting power modules, send CRO(00)
|
||||
GBT_S9_WAIT_BCL = 0x20, // waiting for BCL (requested voltage), send CRO(00)
|
||||
GBT_S10_CHARGING = 0x21, // charging, contactor ON, send CCS, receiving BCL+BCS+BSM
|
||||
GBT_STOP = 0x22, // normal stop
|
||||
GBT_STOP_CSD = 0x23, // normal stop
|
||||
GBT_ERROR = 0x24, // Error
|
||||
GBT_COMPLETE = 0x25,
|
||||
GBT_S4_WAIT_PSU_READY = 0x15, // wait for PSU to be ready
|
||||
GBT_S4_WAIT_PSU_ON = 0x16, // PSU is on, wait for isolation test
|
||||
GBT_S4_ISOTEST = 0x17, // testing isolation, send CHM receive BHM
|
||||
GBT_S4_WAIT_PSU_OFF = 0x18, // PSU is off, wait for battery info
|
||||
GBT_S5_BAT_INFO = 0x19, // identifying BMS, send CRM receive BRM (long)
|
||||
GBT_S6_BAT_STAT = 0x1A, // send CRM(AA), receive BCP (long)
|
||||
GBT_S7_BMS_WAIT = 0x1B, // wait for BMS, send CTS+CML receive BRO(00), next BRO(AA)
|
||||
GBT_S8_INIT_CHARGER = 0x1C,// starting power modules, send CRO(00)
|
||||
GBT_S9_WAIT_BCL = 0x1D, // waiting for BCL (requested voltage), send CRO(00)
|
||||
GBT_S10_CHARGING = 0x1E, // charging, contactor ON, send CCS, receiving BCL+BCS+BSM
|
||||
GBT_STOP = 0x1F, // normal stop
|
||||
GBT_STOP_CSD = 0x20, // normal stop
|
||||
GBT_ERROR = 0x21, // Error
|
||||
GBT_COMPLETE = 0x22,
|
||||
|
||||
}gbtState_t;
|
||||
|
||||
typedef enum __attribute__((packed)){
|
||||
GBT_ERR_OKAY = 0,
|
||||
GBT_ERR_INSULATION = 1,
|
||||
|
||||
}GBT_Error_t;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
typedef struct {
|
||||
@@ -154,32 +161,6 @@ typedef struct {
|
||||
}GBT_CSD_t;
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint8_t enablePSU;
|
||||
uint16_t requestedVoltage; // 0.1V/bit
|
||||
uint16_t requestedCurrent; // 0.1A/bit
|
||||
uint8_t chargingMode; // 0x01 - CV, 0x02 - CC
|
||||
uint8_t chargingPercentage; //
|
||||
uint16_t chargingRemainingTimeMin; //
|
||||
uint16_t chargingElapsedTimeMin; //
|
||||
uint8_t chargingElapsedTimeSec; //
|
||||
|
||||
CONN_State_t connectorState;
|
||||
|
||||
|
||||
}GBT_EDCAN_Output_t;
|
||||
|
||||
typedef struct {
|
||||
uint8_t PSU_Status;
|
||||
uint16_t measuredVoltage; // 0.1V/bit
|
||||
uint16_t measuredCurrent; // 0.1A/bit
|
||||
|
||||
CONN_Control_t chargeControl;
|
||||
GBT_Error_t chargingError; // 0 if okay
|
||||
|
||||
}GBT_EDCAN_Input_t;
|
||||
|
||||
|
||||
/* 500 - Power Supply
|
||||
TX
|
||||
* PSU_ENABLE
|
||||
@@ -223,10 +204,15 @@ extern uint8_t GBT_BRO;
|
||||
|
||||
extern uint8_t GBT_Charger_Enable;
|
||||
|
||||
extern GBT_StopSource_t GBT_StopSource;
|
||||
|
||||
void GBT_Init();
|
||||
void GBT_Start();
|
||||
void GBT_Reset();
|
||||
void GBT_Stop(uint32_t causecode);
|
||||
//void GBT_Stop(uint32_t causecode);
|
||||
void GBT_StopEV(uint32_t causecode);
|
||||
void GBT_StopEVSE(uint32_t causecode);
|
||||
void GBT_StopOCPP(uint32_t causecode);
|
||||
void GBT_ForceStop();
|
||||
void GBT_ChargerTask();
|
||||
void GBT_Error(uint32_t errorcode);
|
||||
@@ -249,6 +235,4 @@ 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