upd example

This commit is contained in:
2025-12-13 22:56:55 +03:00
parent 61182cd5e5
commit 80024101f2

View File

@@ -6,23 +6,33 @@
// MCU Includes
#include "stm32f4xx.h"
#include "stm32f4xx_usart.h"
#include "stm32f4xx_ll_gpio.h"
// Needed Constants
#define DEFAULT_DEVICE_MODBUS_ID 1
#define DEFAULT_TCP_MODBUS_SOCKET 0
#define CURRENT_OPERATION_MODE 1 // UART - 0, TCP - 1
#define DEFAULT_DEVICE_MODBUS_ID 1
#define CURRENT_OPERATION_MODE_TCP
#define RS485_GPIO GPIOB
#define RS485_GPIO_Pin GPIO_Pin_6
#define Modbus_UART USART2
#define Modbus_TIM TIM2
#define Modbus_UART_IRQHandler USART2_IRQHandler
#define Modbus_TIM_IRQHandler TIM2_IRQHandler
#define Modbus_LED GPIOD
#define Modbus_LED_Pin GPIO_Pin_2
#define Modbus_LED GPIOB
#define Modbus_LED_Pin LL_GPIO_PIN_9
#define MODBUS_LED_ON LL_GPIO_SetOutputPin(Modbus_LED, Modbus_LED_Pin);
#define MODBUS_LED_OFF LL_GPIO_ResetOutputPin(Modbus_LED, Modbus_LED_Pin);
#ifdef CURRENT_OPERATION_MODE_UART
#define MODBUS_TX_EN GPIO_WriteBit(RS485_GPIO, RS485_GPIO_Pin, Bit_SET);
#define MODBUS_TX_DIS GPIO_WriteBit(RS485_GPIO, RS485_GPIO_Pin, Bit_RESET);
#define RS485_GPIO GPIOB
#define RS485_GPIO_Pin GPIO_Pin_6
#define Modbus_UART USART2
#define Modbus_TIM TIM2
#define Modbus_UART_IRQHandler USART2_IRQHandler
#define Modbus_TIM_IRQHandler TIM2_IRQHandler
#endif
#ifdef CURRENT_OPERATION_MODE_TCP
#define DEFAULT_TCP_MODBUS_SOCKET 1
#endif
#endif