Files
433_STM32/Core/Inc/main.h

120 lines
3.6 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/* 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 -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f1xx_hal.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include <stdbool.h>
#include <stdio.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 */
/* 硬件模块启用/禁用宏定义 */
#ifndef USE_W5500
#define USE_W5500 1 /* 默认启用W5500以太网模块 */
#endif
#ifndef USE_RS485
#define USE_RS485 1 /* 默认启用RS485通信模块 */
#endif
/* =========================================================
🚀 核心身份标识:烧录不同设备时,请务必修改这个数字!
比如设备A烧录时改为 0x01设备B烧录时改为 0x02
========================================================= */
#define MY_DEVICE_ID 0x01
/* USER CODE END EM */
/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */
/* Private defines -----------------------------------------------------------*/
#define M0_Pin GPIO_PIN_7
#define M0_GPIO_Port GPIOA
#define M1_Pin GPIO_PIN_0
#define M1_GPIO_Port GPIOB
#define AUX_Pin GPIO_PIN_1
#define AUX_GPIO_Port GPIOB
#define RESET_Pin GPIO_PIN_2
#define RESET_GPIO_Port GPIOB
#define W5500_CS_Pin GPIO_PIN_12
#define W5500_CS_GPIO_Port GPIOB
#define W5500_RESET_Pin GPIO_PIN_8
#define W5500_RESET_GPIO_Port GPIOA
#define RL_Control_Pin GPIO_PIN_15
#define RL_Control_GPIO_Port GPIOA
#define LED_RX_Pin GPIO_PIN_3
#define LED_RX_GPIO_Port GPIOB
#define MCU_DI1_Pin GPIO_PIN_4
#define MCU_DI1_GPIO_Port GPIOB
#define MCU_DI2_Pin GPIO_PIN_5
#define MCU_DI2_GPIO_Port GPIOB
#define MCU_DI3_Pin GPIO_PIN_6
#define MCU_DI3_GPIO_Port GPIOB
#define MCU_DI4_Pin GPIO_PIN_7
#define MCU_DI4_GPIO_Port GPIOB
#define LED_TX_Pin GPIO_PIN_9
#define LED_TX_GPIO_Port GPIOB
/* USER CODE BEGIN Private defines */
void gpio_led_tx_on(void);
void gpio_led_tx_off(void);
void gpio_led_rx_on(void);
void gpio_led_rx_off(void);
void systick_interrupt_1ms_callback(void);
void systick_set_user_timeout( uint32_t time_ms );
uint32_t systick_get_user_timeout(void);
void uart1_rx_timeout_1ms_callback(void);
bool uart1_check_rx_done( uint8_t *buffer , uint32_t *length );
/* USER CODE END Private defines */
#ifdef __cplusplus
}
#endif
#endif /* __MAIN_H */