/* USER CODE BEGIN Header */ /** *************************************************************** * 1 2 3 4 5 6 7 8 * * --- +++ * * * ***************************************************************** ****************************************************************************** * @file : main.h * @brief : Header for main.c file. * This file contains the common defines of the application. ****************************************************************************** * @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 __MAIN_H #define __MAIN_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "stm32f1xx_hal.h" #include "modbus_data.h" #include "PROJ_setup.h" #include "dallas_tools.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ typedef enum { FuncOK=0, FuncERROR=1 }FuncStat; typedef enum { CONFIG_DEVICE_ID = 0, CONFIG_BAUDRATE, CONFIG_CALIBRATION, CONFIG_SETTINGS } ConfigParams; typedef enum { STATE_OPEN_VALVE = 0, // open STATE_CLOSE_VALVE= 1 // close } ValveState; typedef struct { uint32_t id[2]; float temp; uint16_t location; uint8_t t_open; float t_set; uint8_t t_close; uint8_t status_T_sense:1 ; ValveState state; uint16_t count; }TEMP_TypeDef; typedef struct { uint32_t init_tsens : 1; // Update Interrupt Flag (бит 0) — флаг переполнения/обновления // ... (другие биты могут быть зарезервированы или использоваться в расширенных таймерах) } Flags_TypeDef; /* USER CODE END Includes */ /* Exported types ------------------------------------------------------------*/ /* USER CODE BEGIN ET */ #define reset_blink_delay 50 #define rest_iter 10 #define GPIOB11_valve MB_DATA.Coils.coils[0].state_val_bit.state_val_01 #define ralay_5v_on GPIOA->ODR&(1<<10); extern void handle_command(char* cmd); typedef void (*FunctionPointer)(void); uint16_t handle_valves(TEMP_TypeDef* temp_sense[MAX_SENSE]); void init_setpoint_all_T_sense(TEMP_TypeDef* temp_sense[MAX_SENSE]); void iwdg_refresh(void); void led_blink(GPIO_TypeDef *GPIOx,uint16_t GPIO_Pin,uint8_t iter,uint16_t delay); FuncStat Field_modbus(MB_DataStructureTypeDef* MB_DATA, Flags_TypeDef* flag); FuncStat packStruct(MB_DataStructureTypeDef* MB_DATA,int sizeARR); void Check_Tconnect(MB_DataStructureTypeDef* MB_DATA, Flags_TypeDef* flag ,DALLAS_HandleTypeDef* hdallas, int a[50]); FuncStat value_control(void ); void reinit_t_sens(void); /* USER CODE END ET */ /* Exported constants --------------------------------------------------------*/ /* USER CODE BEGIN EC */ /* USER CODE END EC */ /* Exported macro ------------------------------------------------------------*/ /* USER CODE BEGIN EM */ /* USER CODE END EM */ /* Exported functions prototypes ---------------------------------------------*/ void Error_Handler(void); /* USER CODE BEGIN EFP */ /* USER CODE END EFP */ /* Private defines -----------------------------------------------------------*/ #define Relay_dc5v_Pin GPIO_PIN_10 #define Relay_dc5v_GPIO_Port GPIOA #define One_wire_Pin GPIO_PIN_15 #define One_wire_GPIO_Port GPIOA /* USER CODE BEGIN Private defines */ /* USER CODE END Private defines */ #ifdef __cplusplus } #endif #endif /* __MAIN_H */