Merge achamaikin/CCSModuleSW30Web upstream with fire alarm retained.

Take upstream board rev2, heater, and project cleanup; preserve fire alarm latch, CMD_FIRE_ALARM, and ESTOP maintenance logic.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
raduet
2026-06-11 13:45:40 +02:00
co-authored by Cursor
91 changed files with 41261 additions and 53693 deletions
+1 -17
View File
@@ -1,21 +1,5 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file adc.h
* @brief This file contains all the function prototypes for
* the adc.c file
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __ADC_H__
+3 -13
View File
@@ -1,14 +1,6 @@
/*
* board.h
*
* Created on: Apr 15, 2024
* Author: colorbass
*/
#pragma once
#ifndef SRC_BOARD_H_
#define SRC_BOARD_H_
void GBT_Lock(uint8_t state);
#include <stdint.h>
typedef enum{
RELAY_AUX0 = 0,
@@ -24,6 +16,7 @@ typedef enum{
} relay_t;
void RELAY_Write(relay_t num, uint8_t state);
uint8_t RELAY_Read(relay_t num);
void Init_Peripheral();
uint8_t GBT_LockGetState();
void GBT_Lock(uint8_t state);
@@ -60,6 +53,3 @@ typedef struct __attribute__((packed)) {
} InfoBlock_t;
extern InfoBlock_t *InfoBlock;
#endif /* SRC_BOARD_H_ */
Executable → Regular
+1 -17
View File
@@ -1,21 +1,5 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file can.h
* @brief This file contains all the function prototypes for
* the can.c file
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __CAN_H__
+5 -3
View File
@@ -5,9 +5,11 @@
#define PSU_MIN_VOLTAGE 150 //1V/bit
#define PSU_MAX_CURRENT 133 //1A/bit
#define PSU_MIN_CURRENT 1 //1A/bit
#define PSU_MAX_POWER 30000 //1W/bit
#define PSU_MAX_POWER 40000 //1W/bit
#define PSU_NUM 1
#define GBT_CH_VER_MAJOR 1
#define GBT_CH_VER_MINOR 0
/* Everest / стенд: запрос «500 В» на шине — реально на PSU задаются U/I ниже; статус может оставаться 500 В (serial.c). */
#define FAKE_EVREQ_VOLTAGE_V 500u
#define FAKE_PSU_VOLTAGE_V 300u
#define FAKE_PSU_CURRENT_0P1A 10u
+1 -19
View File
@@ -1,12 +1,4 @@
/*
* charger_control.h
*
* Created on: Jul 29, 2024
* Author: colorbass
*/
#ifndef INC_CHARGER_CONTROL_H_
#define INC_CHARGER_CONTROL_H_
#pragma once
#include "main.h"
@@ -84,16 +76,6 @@ typedef struct{
extern ChargingConnector_t CONN;
//информация о зарядке
//база данных с хранением инфы
//главный блок хранит в себе инфу о конфиге возможно во флеше
//либо в charger_config.h
//OCPP - универсальный блок типа
void CONN_Init();
void CONN_Loop();
void CONN_PrintChargingTotal();
#endif /* INC_CHARGER_CONTROL_H_ */
+1 -12
View File
@@ -1,12 +1,4 @@
/*
* connector.h
*
* Created on: Jul 31, 2024
* Author: colorbass
*/
#ifndef INC_CONNECTOR_H_
#define INC_CONNECTOR_H_
#pragma once
#include "main.h"
#include "charger_control.h"
@@ -15,7 +7,4 @@
extern CONN_State_t connectorState;
void CONN_Init();
void CONN_Task();
void CONN_SetState(CONN_State_t state);
#endif /* INC_CONNECTOR_H_ */
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef __CP_H
#define __CP_H
#pragma once
#include "main.h"
#include <stdint.h>
@@ -27,5 +26,3 @@ CP_State_t CP_GetFilteredState(void);
void CP_FilterState(void);
void CP_Loop(void);
#endif
+1 -17
View File
@@ -1,21 +1,5 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file crc.h
* @brief This file contains all the function prototypes for
* the crc.c file
******************************************************************************
* @attention
*
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __CRC_H__
+1 -11
View File
@@ -1,12 +1,4 @@
/*
* debug.h
*
* Created on: Apr 16, 2024
* Author: colorbass
*/
#ifndef SRC_DEBUG_H_
#define SRC_DEBUG_H_
#pragma once
#include <stdint.h>
#include <stdarg.h>
@@ -30,5 +22,3 @@ void debug_buffer_send(void);
// Кастомный printf с приоритетом лога
int log_printf(LogLevel_t level, const char *format, ...);
#endif /* SRC_DEBUG_H_ */
+1 -17
View File
@@ -1,21 +1,5 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file dma.h
* @brief This file contains all the function prototypes for
* the dma.c file
******************************************************************************
* @attention
*
* Copyright (c) 2026 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __DMA_H__
Executable → Regular
+1 -17
View File
@@ -1,21 +1,5 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file gpio.h
* @brief This file contains all the function prototypes for
* the gpio.c file
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __GPIO_H__
+1 -4
View File
@@ -1,5 +1,4 @@
#ifndef ISR_OPT_H
#define ISR_OPT_H
#pragma once
/* GCC: быстрые функции, вызываемые из IRQ / из HAL из IRQ-контекста */
#if defined(__GNUC__)
@@ -7,5 +6,3 @@
#else
#define ISR_FAST
#endif
#endif /* ISR_OPT_H */
+7 -17
View File
@@ -1,21 +1,5 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.h
* @brief : Header for main.c file.
* This file contains the common defines of the application.
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
@@ -55,6 +39,8 @@ extern "C" {
void Error_Handler(void);
/* USER CODE BEGIN EFP */
uint8_t ED_TraceWarning(uint8_t flag, uint8_t id);
void ED_Delay(uint32_t Delay);
/* USER CODE END EFP */
@@ -101,8 +87,12 @@ void Error_Handler(void);
#define DBG5_GPIO_Port GPIOB
#define DBG4_Pin GPIO_PIN_11
#define DBG4_GPIO_Port GPIOB
#define LED_DATA_Pin GPIO_PIN_9
#define LED_DATA_GPIO_Port GPIOC
#define RELAY_CC_Pin GPIO_PIN_15
#define RELAY_CC_GPIO_Port GPIOA
#define HEATER_Pin GPIO_PIN_12
#define HEATER_GPIO_Port GPIOC
#define RELAY_DC_Pin GPIO_PIN_3
#define RELAY_DC_GPIO_Port GPIOD
#define USART2_DIR_Pin GPIO_PIN_4
+1 -13
View File
@@ -1,25 +1,15 @@
/*
* psu_struct.h
*
* Created on: Jul 24, 2024
* Author: colorbass
*/
#ifndef INC_METER_H_
#define INC_METER_H_
#pragma once
#include "main.h"
#include "charger_config.h"
typedef struct {
uint32_t meterLastTick; // Время последнего пакета Alive
uint8_t online;
uint32_t lastTick; // Время последнего вызова для каждого коннектора
uint64_t EnergyPSU_Ws; // Энергия для каждого коннектора (расчет по силовым модулям)
uint32_t AbsoluteEnergy; // Абсолютная энергия каждого счетчика (ватт*час)
uint32_t EnergyOffset; // смещение энергии по счетчикам (если 0, значит не успели захватить Offset) (ватт*час)
uint32_t EnergyOffset1; // смещение энергии по счетчикам относительно PSU
uint8_t enable; //если 0, то счетчик обнуляется
}METER_t;
@@ -27,5 +17,3 @@ typedef struct {
extern METER_t METER;
void METER_CalculateEnergy();
#endif /* INC_METER_H_ */
+2 -15
View File
@@ -1,20 +1,11 @@
/*
* ccs_control.h
*
* Created on: 19 авг. 2024 г.
* Author: colorbass
*/
#ifndef INC_PSU_CONTROL_H_
#define INC_PSU_CONTROL_H_
#pragma once
#include "main.h"
#include "charger_config.h"
void PSU_Init();
void PSU_Enable(uint8_t addr, uint8_t enable);
void PSU_Loop();
void CONT_Loop();
void PSU_ReadWrite(void);
// --- Состояние силового модуля (DC30, один PSU) ---
@@ -191,7 +182,3 @@ extern PSU_1B_t PSU_1B;
extern PSU_1C_t PSU_1C;
#pragma pack(pop)
#endif /* INC_PSU_CONTROL_H_ */
+2 -12
View File
@@ -1,12 +1,4 @@
/*
* rgb_handler.h
*
* Created on: Jul 25, 2024
* Author: colorbass
*/
#ifndef INC_RGB_CONTROLLER_H_
#define INC_RGB_CONTROLLER_H_
#pragma once
#include "main.h"
@@ -48,6 +40,4 @@ typedef struct{
void LED_Task();
void LED_Write();
void LED_Init();
#endif /* INC_RGB_CONTROLLER_H_ */
void LED_SetColor(RGB_Cycle_t *color);
Executable → Regular
+1 -17
View File
@@ -1,21 +1,5 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file rtc.h
* @brief This file contains all the function prototypes for
* the rtc.c file
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __RTC_H__
+1 -5
View File
@@ -1,5 +1,4 @@
#ifndef __SERIAL_H
#define __SERIAL_H
#pragma once
#include "main.h"
#include "charger_control.h"
@@ -125,6 +124,3 @@ extern CCS_MaxLoad_t CCS_MaxLoad;
extern CCS_EvInfo_t CCS_EvInfo;
extern CONN_State_t CCS_EvseState;
extern uint8_t REPLUG;
#endif
+1 -6
View File
@@ -1,13 +1,10 @@
#ifndef SERIALCONTROL_H
#define SERIALCONTROL_H
#pragma once
#include "main.h"
#include <string.h>
#include "charger_control.h"
#include "isr_opt.h"
#define USE_WEB_INTERFACE
// Команды от ПК к устройству
// Пакет статуса изоляции от отдельного блока по одностороннему UART
#define CMD_ISOLATION_STATUS 0x01
@@ -182,5 +179,3 @@ extern StatusPacket_t statusPacket;
extern InfoPacket_t infoPacket;
extern IsolationStatusPacket_t ISO;
extern volatile SC_Source_t g_sc_command_source;
#endif // SERIALCONTROL_H
+1 -5
View File
@@ -1,5 +1,4 @@
#ifndef SMA_FILTER_H
#define SMA_FILTER_H
#pragma once
#include <stdint.h>
@@ -18,6 +17,3 @@ typedef struct {
void SMAFilter_Init(SMAFilter_t* f);
int32_t SMAFilter_Update(SMAFilter_t* f, int32_t x);
#endif // SMA_FILTER_H
+1 -11
View File
@@ -1,12 +1,4 @@
/*
* soft_rtc.h
*
* Created on: Jul 22, 2024
* Author: colorbass
*/
#ifndef INC_SOFT_RTC_H_
#define INC_SOFT_RTC_H_
#pragma once
#include "main.h"
@@ -15,5 +7,3 @@ void set_Time(uint32_t unix_time);
void unix_to_bcd(uint32_t unix_time, uint8_t *time);
void writeTimeReg(uint8_t reg_number, uint8_t value);
uint8_t getTimeReg(uint8_t reg_number);
#endif /* INC_SOFT_RTC_H_ */
+1 -16
View File
@@ -1,20 +1,5 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file stm32f1xx_hal_conf.h
* @brief HAL configuration file.
******************************************************************************
* @attention
*
* Copyright (c) 2017 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
+1 -16
View File
@@ -1,20 +1,5 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file stm32f1xx_it.h
* @brief This file contains the headers of the interrupt handlers.
******************************************************************************
* @attention
*
* Copyright (c) 2024 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
+1 -17
View File
@@ -1,21 +1,5 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file tim.h
* @brief This file contains all the function prototypes for
* the tim.c file
******************************************************************************
* @attention
*
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __TIM_H__
+1 -17
View File
@@ -1,21 +1,5 @@
/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file usart.h
* @brief This file contains all the function prototypes for
* the usart.c file
******************************************************************************
* @attention
*
* Copyright (c) 2025 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __USART_H__