global refactoring

This commit is contained in:
Артём Чамайкин
2024-08-14 17:12:36 +03:00
parent a5b0b7db8d
commit b86b879ede
49 changed files with 28155 additions and 15385 deletions

View File

@@ -20,6 +20,7 @@
#include "main.h"
#include "adc.h"
#include "can.h"
#include "rtc.h"
#include "usart.h"
#include "gpio.h"
@@ -32,6 +33,9 @@
#include "charger_gbt.h"
#include "soft_rtc.h"
#include "j1939.h"
#include "lock.h"
#include "connector.h"
/* USER CODE END Includes */
/* Private typedef -----------------------------------------------------------*/
@@ -100,6 +104,7 @@ int main(void)
MX_CAN1_Init();
MX_CAN2_Init();
MX_USART2_UART_Init();
MX_RTC_Init();
/* USER CODE BEGIN 2 */
CAN_ReInit();
Init_Peripheral();
@@ -109,10 +114,12 @@ int main(void)
set_Time(1721651966); //2024-07-22T12:39:26+00:00
printf("Startup (type \'help\' for command list)\n");
debug_init();
//EDCAN_Init(SW_GetAddr()); //0x20..0x23
EDCAN_Init(0x20); //Адрес EDCAN
CAN_ReInit();
EDCAN_Init(SW_GetAddr()); //0x20..0x23
//EDCAN_Init(0x20); //Адрес EDCAN
GBT_CAN_ReInit();
CAN_ReInit();
CONN_Init();
/* USER CODE END 2 */
/* Infinite loop */
@@ -122,11 +129,14 @@ int main(void)
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
// HAL_Delay(1);
EDCAN_Loop();
// can_task();
debug_task();
GBT_ChargerTask();
// HAL_Delay(1);
EDCAN_Loop();
//can_task();
debug_task();
CONN_CC_ReadStateFiltered();
GBT_ManageLock();
CONN_Task();
GBT_ChargerTask();
}
/* USER CODE END 3 */
@@ -145,9 +155,10 @@ void SystemClock_Config(void)
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV5;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.Prediv1Source = RCC_PREDIV1_SOURCE_PLL2;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
@@ -174,7 +185,8 @@ void SystemClock_Config(void)
{
Error_Handler();
}
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_ADC;
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_RTC|RCC_PERIPHCLK_ADC;
PeriphClkInit.RTCClockSelection = RCC_RTCCLKSOURCE_LSE;
PeriphClkInit.AdcClockSelection = RCC_ADCPCLK2_DIV6;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{