Files
GbTModuleEV/Core/Src/gbt_packet.c

57 lines
1.6 KiB
C
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/*
* gbt_packet.c
*
* Created on: Jul 23, 2024
* Author: colorbass
*/
// GB/T Time Synchronization Packet (CTS EVSE->EV)
#include "main.h"
#include "soft_rtc.h"
#include "charger_gbt.h"
// --- EV side GB/T packets (EV->EVSE) ---
// BHM: максимальное напряжение батареи/запрос зарядного напряжения
void GBT_SendBHM(void){
J_SendPacket(0x2700, 6, sizeof(GBT_MaxVoltage), (uint8_t*)&GBT_MaxVoltage);
}
// BRM: базовая информация о батарее/EV
void GBT_SendBRM(void){
J_SendPacket(0x0200, 6, sizeof(GBT_EVInfo), (uint8_t*)&GBT_EVInfo);
}
// BCP: ограничения и статусы батареи
void GBT_SendBCP(void){
J_SendPacket(0x0600, 6, sizeof(GBT_BATStat), (uint8_t*)&GBT_BATStat);
}
// BRO: ответ готовности EV (0x00 / 0xAA)
void GBT_SendBRO(uint8_t state){
uint8_t data[1];
data[0] = state;
J_SendPacket(0x0900, 6, 1, data);
}
// BCL: запрос по напряжению/току от EV
void GBT_SendBCL(void){
J_SendPacket(0x1000, 6, sizeof(GBT_ReqPower), (uint8_t*)&GBT_ReqPower);
}
// BCS: текущий статус заряда с точки зрения EV
void GBT_SendBCS(void){
J_SendPacket(0x1100, 6, sizeof(GBT_ChargingStatus), (uint8_t*)&GBT_ChargingStatus);
}
// BSM: дополнительные статусы батареи
void GBT_SendBSM(void){
J_SendPacket(0x1300, 6, sizeof(GBT_BatteryStatus), (uint8_t*)&GBT_BatteryStatus);
}
// BSD: статус батареи при завершении
void GBT_SendBSD(void){
J_SendPacket(0x1C00, 6, sizeof(GBT_BATStat), (uint8_t*)&GBT_BATStat);
}