已经完成了网络,DI口,RS485的数据透传,可通过RS485接收数据
This commit is contained in:
8
Core/Inc/data_source.h
Normal file
8
Core/Inc/data_source.h
Normal file
@ -0,0 +1,8 @@
|
||||
#ifndef __DATA_SOURCE_H
|
||||
#define __DATA_SOURCE_H
|
||||
|
||||
/* 数据源标识 */
|
||||
#define SOURCE_RS485 0x01
|
||||
#define SOURCE_DI 0x02
|
||||
|
||||
#endif /* __DATA_SOURCE_H */
|
||||
@ -37,6 +37,7 @@ extern "C" {
|
||||
|
||||
/* Exported types ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN ET */
|
||||
|
||||
/* USER CODE END ET */
|
||||
|
||||
/* Exported constants --------------------------------------------------------*/
|
||||
@ -47,6 +48,15 @@ extern "C" {
|
||||
/* Exported macro ------------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EM */
|
||||
|
||||
/* 硬件模块启用/禁用宏定义 */
|
||||
#ifndef USE_W5500
|
||||
#define USE_W5500 1 /* 默认启用W5500以太网模块 */
|
||||
#endif
|
||||
|
||||
#ifndef USE_RS485
|
||||
#define USE_RS485 1 /* 默认启用RS485通信模块 */
|
||||
#endif
|
||||
|
||||
/* USER CODE END EM */
|
||||
|
||||
/* Exported functions prototypes ---------------------------------------------*/
|
||||
|
||||
@ -64,7 +64,7 @@
|
||||
/*#define HAL_SMARTCARD_MODULE_ENABLED */
|
||||
#define HAL_SPI_MODULE_ENABLED
|
||||
/*#define HAL_SRAM_MODULE_ENABLED */
|
||||
/*#define HAL_TIM_MODULE_ENABLED */
|
||||
#define HAL_TIM_MODULE_ENABLED
|
||||
#define HAL_UART_MODULE_ENABLED
|
||||
/*#define HAL_USART_MODULE_ENABLED */
|
||||
/*#define HAL_WWDG_MODULE_ENABLED */
|
||||
|
||||
@ -55,6 +55,7 @@ void SVC_Handler(void);
|
||||
void DebugMon_Handler(void);
|
||||
void PendSV_Handler(void);
|
||||
void SysTick_Handler(void);
|
||||
void TIM2_IRQHandler(void);
|
||||
void USART1_IRQHandler(void);
|
||||
void USART2_IRQHandler(void);
|
||||
void USART3_IRQHandler(void);
|
||||
|
||||
54
Core/Inc/tim.h
Normal file
54
Core/Inc/tim.h
Normal file
@ -0,0 +1,54 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : tim.h
|
||||
* @brief : Header for tim.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 __TIM_H__
|
||||
#define __TIM_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Includes ------------------------------------------------------------------*/
|
||||
#include "main.h"
|
||||
|
||||
/* USER CODE BEGIN Includes */
|
||||
|
||||
/* USER CODE END Includes */
|
||||
|
||||
extern TIM_HandleTypeDef htim2;
|
||||
|
||||
/* USER CODE BEGIN Private defines */
|
||||
|
||||
/* USER CODE END Private defines */
|
||||
|
||||
void MX_TIM2_Init(void);
|
||||
|
||||
/* USER CODE BEGIN Prototypes */
|
||||
|
||||
void MX_TIM2_Init(void);
|
||||
|
||||
/* USER CODE END Prototypes */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __TIM_H__ */
|
||||
|
||||
@ -23,7 +23,7 @@ extern "C" {
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define UART2_TX_BUFFER_SIZE 256
|
||||
#define UART2_TX_BUFFER_SIZE 512
|
||||
|
||||
/**
|
||||
* @brief 初始化UART2打印模块
|
||||
|
||||
@ -86,7 +86,7 @@
|
||||
* 可通过此开关快速切换新旧逻辑
|
||||
*/
|
||||
#ifndef UART3_SMART_ROUTING_ENABLED
|
||||
#define UART3_SMART_ROUTING_ENABLED 1
|
||||
#define UART3_SMART_ROUTING_ENABLED 0
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user