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:
+1
-17
@@ -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
@@ -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
@@ -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,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,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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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_ */
|
||||
|
||||
@@ -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
@@ -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
@@ -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,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 +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
@@ -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,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
@@ -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
@@ -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
@@ -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__
|
||||
|
||||
+1
-17
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file adc.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the ADC instances.
|
||||
******************************************************************************
|
||||
* @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 */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "adc.h"
|
||||
|
||||
+25
-18
@@ -1,13 +1,9 @@
|
||||
|
||||
#include "main.h"
|
||||
#include "board.h"
|
||||
#include "adc.h"
|
||||
#include "tim.h"
|
||||
#include "sma_filter.h"
|
||||
|
||||
//TODO:
|
||||
//TEMP READ
|
||||
// Connector temperature sensors
|
||||
#include "adc.h"
|
||||
#include "main.h"
|
||||
#include "sma_filter.h"
|
||||
#include "tim.h"
|
||||
|
||||
InfoBlock_t *InfoBlock = (InfoBlock_t *)(VERSION_OFFSET);
|
||||
|
||||
@@ -74,19 +70,31 @@ uint8_t IN_ReadInput(inputNum_t input_n){
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t GetBoardTemp(){
|
||||
//TODO
|
||||
// HAL_ADC_Start(&hadc1); // start the adc
|
||||
//
|
||||
// HAL_ADC_PollForConversion(&hadc1, 100); // poll for conversion
|
||||
//
|
||||
// adc_val = HAL_ADC_GetValue(&hadc1); // get the adc value
|
||||
//
|
||||
// HAL_ADC_Stop(&hadc1); // stop adc
|
||||
/* Заглушка: температура платы не измеряется (нет реализации АЦП для канала). */
|
||||
uint8_t GetBoardTemp(void){
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Force PC12 (HEATER) as GPIO output via CRH/ODR, overriding UART5 MspInit.
|
||||
* CubeMX assigns PC12 to UART5_TX; on the board it drives the heater relay.
|
||||
*/
|
||||
static void Heater_PinForceOutput(void)
|
||||
{
|
||||
const uint32_t pin_cfg = GPIO_SPEED_FREQ_LOW; /* MODE=10, CNF=00: GP output PP, 2 MHz */
|
||||
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
|
||||
MODIFY_REG(HEATER_GPIO_Port->CRH,
|
||||
(GPIO_CRH_MODE12 | GPIO_CRH_CNF12),
|
||||
(pin_cfg << GPIO_CRH_MODE12_Pos));
|
||||
|
||||
HEATER_GPIO_Port->BSRR = (uint32_t)HEATER_Pin << 16U;
|
||||
}
|
||||
|
||||
void Init_Peripheral(){
|
||||
Heater_PinForceOutput();
|
||||
HAL_GPIO_WritePin(HEATER_GPIO_Port, HEATER_Pin, GPIO_PIN_RESET);
|
||||
HAL_ADCEx_Calibration_Start(&hadc1);
|
||||
ADC_ScanStart();
|
||||
|
||||
@@ -138,7 +146,6 @@ int16_t CONN_ReadTemp(uint8_t ch){
|
||||
return 20; //Термодатчик не подключен
|
||||
}
|
||||
|
||||
// int adc_value = 2048; // Пример значения АЦП
|
||||
float Vref = 3.3; // Напряжение опорное
|
||||
float Vin = 5.0; // Входное напряжение
|
||||
float R = 1000; // Сопротивление резистора в Омах
|
||||
|
||||
+1
-17
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file can.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the CAN instances.
|
||||
******************************************************************************
|
||||
* @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 */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "can.h"
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
|
||||
#include "charger_control.h"
|
||||
|
||||
#include "charger_config.h"
|
||||
#include "psu_control.h"
|
||||
#include "connector.h"
|
||||
#include "debug.h"
|
||||
#include "fire_alarm.h"
|
||||
#include "psu_control.h"
|
||||
|
||||
ChargingConnector_t CONN;
|
||||
CONN_State_t connectorState;
|
||||
extern uint8_t config_initialized;
|
||||
|
||||
void CONN_Init(){
|
||||
|
||||
@@ -36,24 +34,16 @@ void CONN_Loop(){
|
||||
CONN.chargingError = CONN_ERR_CONTACTOR;
|
||||
} else if(PSU0.psu_fault){
|
||||
CONN.chargingError = CONN_ERR_PSU_FAULT;
|
||||
// } else if(!CTRL.ac_ok) {
|
||||
// CONN.chargingError = CONN_ERR_AC_FAULT;
|
||||
// } else
|
||||
}else if (CONN.EvConnected == 0){
|
||||
CONN.chargingError = CONN_NO_ERROR;
|
||||
}
|
||||
|
||||
if(ED_TraceWarning(CONN.chargingError, 0)) printf("CONN%d Error: %d\n", 0, CONN.chargingError);
|
||||
if(ED_TraceWarning(CONN.chargingError, 0)) {
|
||||
log_printf(LOG_WARN, "CONN0 Error: %d\n", (int)CONN.chargingError);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void CONN_Task(){
|
||||
/* CCS state machine is handled in serial.c.
|
||||
* Keep this task lightweight for scheduler compatibility.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
|
||||
void CONN_SetState(CONN_State_t state){
|
||||
if (connectorState == state) {
|
||||
CONN.connState = state;
|
||||
@@ -79,10 +69,3 @@ void CONN_SetState(CONN_State_t state){
|
||||
|
||||
CONN.connState = state;
|
||||
}
|
||||
|
||||
void CONN_PrintChargingTotal(){
|
||||
printf("CONN%d Charging Finished:\n", 0);
|
||||
// printf("Charging Time: %d\n", CONN.chargingTime);
|
||||
printf("Charging Energy: %d\n", CONN.Energy);
|
||||
// printf("Charging Power: %d\n", CONN.chargingPower);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "cp.h"
|
||||
|
||||
#include "adc.h"
|
||||
#include "board.h"
|
||||
#include "debug.h"
|
||||
|
||||
+1
-17
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file crc.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the CRC instances.
|
||||
******************************************************************************
|
||||
* @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 */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "crc.h"
|
||||
|
||||
+7
-14
@@ -1,21 +1,14 @@
|
||||
/*
|
||||
* debug.c
|
||||
*
|
||||
* Created on: Apr 16, 2024
|
||||
* Author: colorbass
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
#include "board.h"
|
||||
#include "connector.h"
|
||||
#include "debug.h"
|
||||
#include "serial_control.h"
|
||||
#include "usart.h"
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include "debug.h"
|
||||
#include "board.h"
|
||||
#include "usart.h"
|
||||
#include <time.h>
|
||||
#include <connector.h>
|
||||
#include "serial_control.h"
|
||||
|
||||
// Кольцевой буфер для отладочных сообщений
|
||||
#define DEBUG_BUFFER_SIZE 1024
|
||||
|
||||
+1
-17
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file dma.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of all the requested memory to memory DMA transfers.
|
||||
******************************************************************************
|
||||
* @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 */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
|
||||
+5
-20
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file gpio.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of all used GPIO pins.
|
||||
******************************************************************************
|
||||
* @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 */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
@@ -54,7 +38,8 @@ void MX_GPIO_Init(void)
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOC, DBG1_Pin|RELAY_CP_Pin|LOCK_A_Pin|LOCK_B_Pin, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOC, DBG1_Pin|RELAY_CP_Pin|LOCK_A_Pin|LOCK_B_Pin
|
||||
|LED_DATA_Pin, GPIO_PIN_RESET);
|
||||
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOA, DBG2_Pin|DBG3_Pin|RELAY_CC_Pin, GPIO_PIN_RESET);
|
||||
@@ -76,8 +61,8 @@ void MX_GPIO_Init(void)
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
HAL_GPIO_Init(DBG1_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pins : RELAY_CP_Pin LOCK_A_Pin LOCK_B_Pin */
|
||||
GPIO_InitStruct.Pin = RELAY_CP_Pin|LOCK_A_Pin|LOCK_B_Pin;
|
||||
/*Configure GPIO pins : RELAY_CP_Pin LOCK_A_Pin LOCK_B_Pin LED_DATA_Pin */
|
||||
GPIO_InitStruct.Pin = RELAY_CP_Pin|LOCK_A_Pin|LOCK_B_Pin|LED_DATA_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
|
||||
+11
-10
@@ -1,4 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
|
||||
/* USER CODE END Header */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
@@ -13,15 +14,17 @@
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
#include "can.h"
|
||||
#include "board.h"
|
||||
#include <stdio.h>
|
||||
#include "debug.h"
|
||||
#include "soft_rtc.h"
|
||||
#include "connector.h"
|
||||
#include "serial_control.h"
|
||||
#include "charger_config.h"
|
||||
#include "connector.h"
|
||||
#include "debug.h"
|
||||
#include "meter.h"
|
||||
#include "psu_control.h"
|
||||
#include "rgb_controller.h"
|
||||
#include "serial.h"
|
||||
#include "serial_control.h"
|
||||
#include "soft_rtc.h"
|
||||
#include <stdio.h>
|
||||
/* USER CODE END Includes */
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
@@ -53,6 +56,7 @@ void SystemClock_Config(void);
|
||||
|
||||
/* Private user code ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN 0 */
|
||||
static void StopButtonControl(void);
|
||||
|
||||
/**
|
||||
* @brief Vector base address configuration. It should no longer be at the start of
|
||||
@@ -99,13 +103,12 @@ void ED_Delay(uint32_t Delay)
|
||||
CCS_SerialLoop();
|
||||
StopButtonControl();
|
||||
CP_Loop();
|
||||
CONN_Task();
|
||||
LED_Task();
|
||||
SC_Task();
|
||||
}
|
||||
}
|
||||
|
||||
void StopButtonControl(){
|
||||
static void StopButtonControl(void){
|
||||
static uint32_t tick;
|
||||
static uint32_t hold_time;
|
||||
static uint8_t stop_btn_fault = 1;
|
||||
@@ -146,8 +149,6 @@ void StopButtonControl(){
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t temp0, temp1;
|
||||
|
||||
static void CAN1_MinimalReInit(void)
|
||||
{
|
||||
HAL_CAN_Stop(&hcan1);
|
||||
|
||||
+1
-9
@@ -1,13 +1,5 @@
|
||||
/*
|
||||
* meter.c
|
||||
*
|
||||
* Created on: 27 сент. 2024 г.
|
||||
* Author: root
|
||||
*/
|
||||
|
||||
|
||||
#include "meter.h"
|
||||
#include "charger_config.h"
|
||||
|
||||
#include "charger_control.h"
|
||||
|
||||
|
||||
|
||||
+8
-15
@@ -1,14 +1,13 @@
|
||||
#include "psu_control.h"
|
||||
|
||||
#include <psu_control.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "can.h"
|
||||
#include "string.h"
|
||||
#include "stdio.h"
|
||||
#include "charger_config.h"
|
||||
#include "charger_control.h"
|
||||
#include "board.h"
|
||||
#include "debug.h"
|
||||
#include "isr_opt.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
PSU_02_t PSU_02;
|
||||
PSU_04_t PSU_04;
|
||||
@@ -31,6 +30,8 @@ uint32_t can_lastpacket;
|
||||
|
||||
extern CAN_HandleTypeDef hcan2;
|
||||
|
||||
static void PSU_SendCmd(uint8_t source, uint8_t destination, uint8_t cmd, void *data);
|
||||
|
||||
static void PSU_SwitchState(PSU_State_t state){
|
||||
PSU0.state = state;
|
||||
PSU0.statetick = HAL_GetTick();
|
||||
@@ -227,7 +228,6 @@ void PSU_SendCmd(uint8_t source, uint8_t destination, uint8_t cmd, void *data){
|
||||
/* если отправка удалась, выход */
|
||||
if(CAN_result == HAL_OK) {
|
||||
return;
|
||||
retry_counter = 0;
|
||||
}
|
||||
}
|
||||
ED_Delay(1);
|
||||
@@ -237,11 +237,6 @@ void PSU_SendCmd(uint8_t source, uint8_t destination, uint8_t cmd, void *data){
|
||||
|
||||
}
|
||||
|
||||
uint32_t max(uint32_t a, uint32_t b){
|
||||
if(a>b) return a;
|
||||
else return b;
|
||||
}
|
||||
|
||||
void PSU_ReadWrite(){
|
||||
|
||||
uint8_t zero_data[8] = {0,0,0,0,0,0,0,0};
|
||||
@@ -264,8 +259,8 @@ void PSU_ReadWrite(){
|
||||
CONN.RequestedPower = CONN.RequestedCurrent * CONN.RequestedVoltage / 10;
|
||||
|
||||
if(PSU0.ready){
|
||||
if (CONN.RequestedVoltage == 500) { // fake
|
||||
PSU_SetVoltageCurrent(0, 300, 10); // Normal mode
|
||||
if (CONN.RequestedVoltage == FAKE_EVREQ_VOLTAGE_V) {
|
||||
PSU_SetVoltageCurrent(0, (uint16_t)FAKE_PSU_VOLTAGE_V, (uint16_t)FAKE_PSU_CURRENT_0P1A);
|
||||
}else{
|
||||
PSU_SetVoltageCurrent(0, CONN.RequestedVoltage, CONN.RequestedCurrent); // Normal mode
|
||||
}
|
||||
@@ -288,7 +283,6 @@ void PSU_ReadWrite(){
|
||||
|
||||
void PSU_Task(void){
|
||||
static uint32_t psu_on_tick = 0;
|
||||
static uint32_t dc_on_tick = 0;
|
||||
static uint32_t cont_ok_tick = 0;
|
||||
|
||||
// Обновляем ONLINE/READY по таймауту
|
||||
@@ -368,7 +362,6 @@ void PSU_Task(void){
|
||||
case PSU_WAIT_ACK_ON:
|
||||
|
||||
if(PSU0.PSU_enabled && PSU0.ready){
|
||||
dc_on_tick = HAL_GetTick();
|
||||
PSU_SwitchState(PSU_CONT_WAIT_ACK_ON);
|
||||
}else if(PSU_StateTime() > 10000){
|
||||
PSU0.psu_fault = 1;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include "rgb_controller.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "charger_control.h"
|
||||
#include "fire_alarm.h"
|
||||
#include "main.h"
|
||||
#include "string.h"
|
||||
#include "charger_control.h"
|
||||
#include "board.h"
|
||||
|
||||
#include "tim.h"
|
||||
#include <string.h>
|
||||
|
||||
RGB_State_t LED_State;
|
||||
RGB_Cycle_t LED_Cycle;
|
||||
@@ -203,36 +203,11 @@ void LED_Init(){
|
||||
RGB_SetColor(&color);
|
||||
}
|
||||
|
||||
// void LED_PhaseSync(uint8_t led_n){
|
||||
// if(LED_State[led_n].phasesync){
|
||||
// LED_State[led_n].phasesync = 0;
|
||||
// //default settings
|
||||
// LED_State[led_n].state = LED_HIGH;
|
||||
// LED_State[led_n].tick = 0;
|
||||
// //ищем среди всех светодиодов такую же последовательность
|
||||
// for (uint8_t led_n1 = 0; led_n1 < 5; led_n1++){
|
||||
// if ((LED_Cycle[led_n].Tf == LED_Cycle[led_n1].Tf) &&
|
||||
// (LED_Cycle[led_n].Tr == LED_Cycle[led_n1].Tr) &&
|
||||
// (LED_Cycle[led_n].Th == LED_Cycle[led_n1].Th) &&
|
||||
// (LED_Cycle[led_n].Tl == LED_Cycle[led_n1].Tl) &&
|
||||
// (led_n != led_n1)){
|
||||
// //если нашли, то копируем фазу оттуда
|
||||
// LED_State[led_n].state = LED_State[led_n1].state;
|
||||
// LED_State[led_n].tick = LED_State[led_n1].tick;
|
||||
// return;
|
||||
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
void LED_Task(){
|
||||
static uint32_t led_tick;
|
||||
if((HAL_GetTick() - led_tick) > 20){
|
||||
led_tick = HAL_GetTick();
|
||||
LED_State.tick++;
|
||||
// LED_PhaseSync(led_n);
|
||||
switch(LED_State.state){
|
||||
case LED_RISING:
|
||||
interpolateColors(&LED_Cycle.Color2, &LED_Cycle.Color1, LED_State.tick, LED_Cycle.Tr, &LED_State.color);
|
||||
|
||||
+7
-12
@@ -1,15 +1,16 @@
|
||||
#include "serial.h"
|
||||
#include "cp.h"
|
||||
#include "connector.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "charger_config.h"
|
||||
#include "connector.h"
|
||||
#include "cp.h"
|
||||
#include "debug.h"
|
||||
#include "isr_opt.h"
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
#include "charger_config.h"
|
||||
#include "fire_alarm.h"
|
||||
#include "psu_control.h"
|
||||
#include "serial_control.h"
|
||||
#include "fire_alarm.h"
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
extern UART_HandleTypeDef huart3;
|
||||
extern uint8_t config_initialized;
|
||||
@@ -29,15 +30,9 @@ CONN_Control_t last_cmd = CMD_NONE;
|
||||
uint8_t ev_enable_output = 0;
|
||||
|
||||
#define CMD_INTERVAL 10
|
||||
#define MAX_TX_BUFFER_SIZE 256
|
||||
#define MAX_RX_BUFFER_SIZE 256
|
||||
#define EVEREST_TIMEOUT_WARN_MS 5000u
|
||||
#define EVEREST_TIMEOUT_STOP_MS 10000u
|
||||
#define UART3_REINIT_TIMEOUT_MS 1500u
|
||||
/* Everest requests 500 V -> PSU really gets 300 V / 1 A, state still reports 500 V. */
|
||||
#define FAKE_EVREQ_VOLTAGE_V 500u
|
||||
#define FAKE_PSU_VOLTAGE_V 300u
|
||||
#define FAKE_PSU_CURRENT_0P1A 10u
|
||||
|
||||
static uint8_t rx_buffer[MAX_RX_BUFFER_SIZE];
|
||||
static uint8_t tx_buffer[MAX_TX_BUFFER_SIZE];
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "serial_control.h"
|
||||
#include "usart.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "serial.h"
|
||||
#include "debug.h"
|
||||
#include "isr_opt.h"
|
||||
#include "serial.h"
|
||||
#include "usart.h"
|
||||
|
||||
// Приватные функции
|
||||
ISR_FAST static uint32_t calculate_crc32(const uint8_t* data, uint16_t length);
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
#include "serial_control.h"
|
||||
#include "usart.h"
|
||||
#include "charger_control.h"
|
||||
|
||||
#include "board.h"
|
||||
#include "psu_control.h"
|
||||
#include "charger_control.h"
|
||||
#include "debug.h"
|
||||
#include "fire_alarm.h"
|
||||
#include "psu_control.h"
|
||||
#include "usart.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef USE_WEB_INTERFACE
|
||||
|
||||
extern volatile SC_Source_t g_sc_command_source;
|
||||
static void monitoring_data_callback(void);
|
||||
|
||||
IsolationStatusPacket_t ISO = {
|
||||
.isolationResistance = 0xFFFF
|
||||
@@ -133,7 +133,7 @@ void SC_CommandHandler(ReceivedCommand_t* cmd) {
|
||||
|
||||
|
||||
// Колбэк для заполнения данных мониторинга
|
||||
void monitoring_data_callback() {
|
||||
static void monitoring_data_callback(void) {
|
||||
|
||||
// Информация о зарядной сессии
|
||||
statusPacket.SOC = CONN.SOC;
|
||||
@@ -213,4 +213,3 @@ void monitoring_data_callback() {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+2
-22
@@ -1,11 +1,4 @@
|
||||
/*
|
||||
* rtc.c
|
||||
*
|
||||
* Created on: Jul 22, 2024
|
||||
* Author: colorbass
|
||||
*/
|
||||
|
||||
#include <soft_rtc.h>
|
||||
#include "soft_rtc.h"
|
||||
#include <stdint.h>
|
||||
#include <time.h>
|
||||
|
||||
@@ -63,20 +56,7 @@ uint8_t getTimeReg(uint8_t reg_number){
|
||||
}else{
|
||||
return 0x00;
|
||||
}
|
||||
};
|
||||
//int main() {
|
||||
// uint32_t unix_time = 1672531199; // Example Unix timestamp
|
||||
// uint8_t time[8];
|
||||
//
|
||||
// unix_to_bcd(unix_time, time);
|
||||
//
|
||||
// // Print the BCD values for verification
|
||||
// for (int i = 0; i < 8; i++) {
|
||||
// log_printf(LOG_INFO, "time[%d]: %02X\n", i, time[i]);
|
||||
// }
|
||||
//
|
||||
// return 0;
|
||||
//}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Read the time counter available in RTC_CNT registers.
|
||||
|
||||
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f1xx_hal_msp.c
|
||||
* @brief This file provides code for the MSP Initialization
|
||||
* and de-Initialization codes.
|
||||
******************************************************************************
|
||||
* @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 */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
|
||||
+1
-16
@@ -1,20 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file stm32f1xx_it.c
|
||||
* @brief Interrupt Service Routines.
|
||||
******************************************************************************
|
||||
* @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 */
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
|
||||
+1
-17
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file tim.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the TIM instances.
|
||||
******************************************************************************
|
||||
* @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 */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "tim.h"
|
||||
|
||||
+4
-20
@@ -1,21 +1,5 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file usart.c
|
||||
* @brief This file provides code for the configuration
|
||||
* of the USART instances.
|
||||
******************************************************************************
|
||||
* @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 */
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "usart.h"
|
||||
@@ -167,10 +151,10 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
|
||||
PC12 ------> UART5_TX
|
||||
PD2 ------> UART5_RX
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_12;
|
||||
GPIO_InitStruct.Pin = HEATER_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
HAL_GPIO_Init(HEATER_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_2;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
|
||||
@@ -361,7 +345,7 @@ void HAL_UART_MspDeInit(UART_HandleTypeDef* uartHandle)
|
||||
PC12 ------> UART5_TX
|
||||
PD2 ------> UART5_RX
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_12);
|
||||
HAL_GPIO_DeInit(HEATER_GPIO_Port, HEATER_Pin);
|
||||
|
||||
HAL_GPIO_DeInit(GPIOD, GPIO_PIN_2);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user