237 lines
6.2 KiB
C
237 lines
6.2 KiB
C
/* 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) 2023 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 "stm32f7xx_hal.h"
|
|
|
|
#include "stm32f7xx_ll_dma.h"
|
|
#include "stm32f7xx_ll_spi.h"
|
|
#include "stm32f7xx_ll_tim.h"
|
|
#include "stm32f7xx_ll_usart.h"
|
|
#include "stm32f7xx_ll_rcc.h"
|
|
#include "stm32f7xx_ll_bus.h"
|
|
#include "stm32f7xx_ll_cortex.h"
|
|
#include "stm32f7xx_ll_system.h"
|
|
#include "stm32f7xx_ll_utils.h"
|
|
#include "stm32f7xx_ll_pwr.h"
|
|
#include "stm32f7xx_ll_gpio.h"
|
|
|
|
#include "stm32f7xx_ll_exti.h"
|
|
|
|
/* Private includes ----------------------------------------------------------*/
|
|
/* USER CODE BEGIN Includes */
|
|
|
|
/* USER CODE END Includes */
|
|
|
|
/* Exported types ------------------------------------------------------------*/
|
|
/* USER CODE BEGIN ET */
|
|
|
|
/* 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 ADC_MPD2_CS_Pin GPIO_PIN_6
|
|
#define ADC_MPD2_CS_GPIO_Port GPIOF
|
|
#define SPI5_CNV_Pin GPIO_PIN_9
|
|
#define SPI5_CNV_GPIO_Port GPIOF
|
|
#define ADC_ThrLD2_CS_Pin GPIO_PIN_10
|
|
#define ADC_ThrLD2_CS_GPIO_Port GPIOF
|
|
#define EN_5V2_Pin GPIO_PIN_2
|
|
#define EN_5V2_GPIO_Port GPIOC
|
|
#define EN_5V1_Pin GPIO_PIN_3
|
|
#define EN_5V1_GPIO_Port GPIOC
|
|
#define TECEN1_Pin GPIO_PIN_0
|
|
#define TECEN1_GPIO_Port GPIOA
|
|
#define TECEN2_Pin GPIO_PIN_1
|
|
#define TECEN2_GPIO_Port GPIOA
|
|
#define REF2_ON_Pin GPIO_PIN_3
|
|
#define REF2_ON_GPIO_Port GPIOA
|
|
#define DAC_TEC2_CS_Pin GPIO_PIN_4
|
|
#define DAC_TEC2_CS_GPIO_Port GPIOA
|
|
#define DAC_LD2_CS_Pin GPIO_PIN_6
|
|
#define DAC_LD2_CS_GPIO_Port GPIOA
|
|
#define LD2_EN_Pin GPIO_PIN_4
|
|
#define LD2_EN_GPIO_Port GPIOC
|
|
#define TEC2_PD_Pin GPIO_PIN_5
|
|
#define TEC2_PD_GPIO_Port GPIOC
|
|
#define TEC2_FLAG1_Pin GPIO_PIN_11
|
|
#define TEC2_FLAG1_GPIO_Port GPIOF
|
|
#define TEC2_FLAG2_Pin GPIO_PIN_12
|
|
#define TEC2_FLAG2_GPIO_Port GPIOF
|
|
#define TEC1_FLAG1_Pin GPIO_PIN_13
|
|
#define TEC1_FLAG1_GPIO_Port GPIOF
|
|
#define TEC1_FLAG2_Pin GPIO_PIN_14
|
|
#define TEC1_FLAG2_GPIO_Port GPIOF
|
|
#define ADC_MPD1_CS_Pin GPIO_PIN_10
|
|
#define ADC_MPD1_CS_GPIO_Port GPIOE
|
|
#define ADC_ThrLD1_CS_Pin GPIO_PIN_11
|
|
#define ADC_ThrLD1_CS_GPIO_Port GPIOE
|
|
#define SPI4_CNV_Pin GPIO_PIN_14
|
|
#define SPI4_CNV_GPIO_Port GPIOE
|
|
#define REF0_EN_Pin GPIO_PIN_10
|
|
#define REF0_EN_GPIO_Port GPIOB
|
|
#define TEC1_PD_Pin GPIO_PIN_11
|
|
#define TEC1_PD_GPIO_Port GPIOB
|
|
#define DAC_TEC1_CS_Pin GPIO_PIN_12
|
|
#define DAC_TEC1_CS_GPIO_Port GPIOB
|
|
#define DAC_LD1_CS_Pin GPIO_PIN_14
|
|
#define DAC_LD1_CS_GPIO_Port GPIOB
|
|
#define LD1_EN_Pin GPIO_PIN_8
|
|
#define LD1_EN_GPIO_Port GPIOD
|
|
#define USB_FLAG_Pin GPIO_PIN_8
|
|
#define USB_FLAG_GPIO_Port GPIOA
|
|
#define SDMMC1_EN_Pin GPIO_PIN_0
|
|
#define SDMMC1_EN_GPIO_Port GPIOD
|
|
#define TEST_01_Pin GPIO_PIN_1
|
|
#define TEST_01_GPIO_Port GPIOD
|
|
#define FPGA_CONF_DONE_Pin GPIO_PIN_1
|
|
#define FPGA_CONF_DONE_GPIO_Port GPIOE
|
|
|
|
/* USER CODE BEGIN Private defines */
|
|
#define CL_16 15
|
|
#define DL_16 15
|
|
#define CL_8 30
|
|
#define DL_8 30
|
|
#define TSK_8 32
|
|
#define TSK_16 16
|
|
|
|
|
|
// #define SD_Length 100
|
|
|
|
#define HALT 0
|
|
#define DECODE_ENABLE 1
|
|
#define DEFAULT_ENABLE 2
|
|
#define TRANS_S_ENABLE 3
|
|
#define TRANS_ENABLE 4
|
|
#define REMOVE_FILE 5
|
|
#define STATE 6
|
|
#define WORK_ENABLE 7
|
|
#define DECODE_TASK 8
|
|
#define RUN_TASK 9
|
|
|
|
#define SD_ERR 0x01
|
|
#define UART_ERR 0x02
|
|
#define UART_DECODE_ERR 0x04
|
|
#define TEC1_ERR 0x08
|
|
#define TEC2_ERR 0x10
|
|
#define DEFAUL_ERR 0x20
|
|
#define REMOVE_ERR 0x40
|
|
|
|
#define NO_MESS 0
|
|
#define MESS_01 1
|
|
#define MESS_02 2
|
|
#define MESS_03 3
|
|
|
|
typedef struct{
|
|
|
|
uint8_t WORK_EN;
|
|
uint8_t U5V1_EN;
|
|
uint8_t U5V2_EN;
|
|
uint8_t LD1_EN;
|
|
uint8_t LD2_EN;
|
|
uint8_t REF1_EN;
|
|
uint8_t REF2_EN;
|
|
uint8_t TEC1_EN;
|
|
uint8_t TEC2_EN;
|
|
uint8_t TS1_EN;
|
|
uint8_t TS2_EN;
|
|
uint8_t SD_EN;
|
|
uint8_t PI1_RD;
|
|
uint8_t PI2_RD;
|
|
|
|
uint16_t AVERAGES;
|
|
uint16_t MES_ID;
|
|
|
|
}Work_SetupTypeDef;
|
|
|
|
typedef struct{
|
|
|
|
uint16_t LD_TEMP;
|
|
float P_coef_temp;
|
|
float I_coef_temp;
|
|
uint16_t CURRENT;
|
|
|
|
}LDx_SetupTypeDef;
|
|
|
|
typedef struct{
|
|
|
|
uint16_t LD_CURR_TEMP;
|
|
float e_integral;
|
|
uint16_t POWER;
|
|
|
|
}LDx_ParamTypeDef;
|
|
|
|
typedef enum _task_type_t
|
|
{
|
|
TT_CHANGE_CURR_1 = 0x1,
|
|
TT_CHANGE_CURR_2 = 0x2,
|
|
TT_CHANGE_TEMP_1 = 0x3,
|
|
TT_CHANGE_TEMP_2 = 0x4,
|
|
} task_type_t;
|
|
|
|
typedef struct _task_t
|
|
{
|
|
task_type_t task_type;
|
|
float min_param;
|
|
float max_param;
|
|
float delta_param; // change step between min_param and max_param
|
|
float current_param; // current_param is iterating by summary with delta_param every interrupt
|
|
uint8_t dt; // microseconds
|
|
uint16_t tau; // milliseconds or microseconds?
|
|
float sec_param;
|
|
float curr;
|
|
float temp;
|
|
float i_coef_1;
|
|
float p_coef_1;
|
|
float i_coef_2;
|
|
float p_coef_2;
|
|
} task_t;
|
|
/* USER CODE END Private defines */
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* __MAIN_H */
|