初始提交
This commit is contained in:
+112
@@ -0,0 +1,112 @@
|
||||
/* 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) 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 "stm32h7xx_hal.h"
|
||||
|
||||
/* Private includes ----------------------------------------------------------*/
|
||||
/* USER CODE BEGIN Includes */
|
||||
#include "stdio.h"
|
||||
#include "stdint.h"
|
||||
#include "string.h"
|
||||
/* 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 */
|
||||
#define VERSION_STR "V8.5.0"
|
||||
#ifdef BOOTLOADER
|
||||
#define SW_VER "BL for " VERSION_STR
|
||||
#else
|
||||
#define SW_VER VERSION_STR
|
||||
#endif
|
||||
|
||||
/* USER CODE END EM */
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
void Error_Handler(void);
|
||||
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
/* USER CODE END EFP */
|
||||
|
||||
/* Private defines -----------------------------------------------------------*/
|
||||
#define DI_RELAY_Pin GPIO_PIN_1
|
||||
#define DI_RELAY_GPIO_Port GPIOA
|
||||
#define DI_SAMPLE_Pin GPIO_PIN_2
|
||||
#define DI_SAMPLE_GPIO_Port GPIOA
|
||||
#define WDI_Pin GPIO_PIN_10
|
||||
#define WDI_GPIO_Port GPIOB
|
||||
#define WDO_Pin GPIO_PIN_11
|
||||
#define WDO_GPIO_Port GPIOB
|
||||
#define FLASH_CS_Pin GPIO_PIN_15
|
||||
#define FLASH_CS_GPIO_Port GPIOA
|
||||
#define DO_RELAY_Pin GPIO_PIN_6
|
||||
#define DO_RELAY_GPIO_Port GPIOB
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
#define DEBUG 1
|
||||
#if DEBUG
|
||||
#define debug(fmt, args...) printf(fmt"\r\n", ##args)
|
||||
#define dump(buf, len) do { int __i = 0; /*printf("\xAA\xAA");*/ for (__i = 0; __i < (len); __i++) {printf("%02X ", ((uint8_t *)(buf))[__i]);} printf("\r\n"); } while (0)
|
||||
|
||||
#define assert(err,fmt, args...) if (!(err)) do {printf("\xAA\xAA"); printf(fmt"\r\n", ##args); while(1);} while (0)
|
||||
#define func_enter() printf("enter %s\r\n", __func__)
|
||||
#define func_exit() printf("exit %s\r\n", __func__)
|
||||
#else
|
||||
#define dump(buf, len)
|
||||
|
||||
#define debug(args...)
|
||||
#define assert(args...)
|
||||
#define func_enter()
|
||||
#define func_exit()
|
||||
#endif
|
||||
|
||||
|
||||
#define DI_REALY_ASSERTED() (HAL_GPIO_ReadPin(DI_RELAY_GPIO_Port, DI_RELAY_Pin) == GPIO_PIN_RESET)
|
||||
#define DI_SIMPLE_ASSERTED() (HAL_GPIO_ReadPin(DI_SAMPLE_GPIO_Port, DI_SAMPLE_Pin) == GPIO_PIN_RESET)
|
||||
|
||||
#define DO_RELAY_ASSERT() (HAL_GPIO_WritePin(DO_RELAY_GPIO_Port, DO_RELAY_Pin, GPIO_PIN_SET))
|
||||
#define DO_RELAY_DEASSERT() (HAL_GPIO_WritePin(DO_RELAY_GPIO_Port, DO_RELAY_Pin, GPIO_PIN_RESET))
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __MAIN_H */
|
||||
Reference in New Issue
Block a user