Files
ModbusSlave/modbus_constants_example.h

39 lines
1.2 KiB
C

#ifndef _MODBUS_CONSTANTS_H
#define _MODBUS_CONSTANTS_H
#define MAX_HOLDING_REGISTERS 300
#define MAX_INPUT_REGISTERS 300
// MCU Includes
#include "stm32f4xx_ll_lptim.h"
#include "stm32f4xx_ll_gpio.h"
#include "stm32f4xx_ll_tim.h"
// Needed Constants
#define DEFAULT_DEVICE_MODBUS_ID 1
#define CURRENT_OPERATION_MODE_UART
#define Modbus_LED GPIOB
#define Modbus_LED_Pin LL_GPIO_PIN_2
#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 LL_GPIO_SetOutputPin(RS485_GPIO, RS485_GPIO_Pin);
#define MODBUS_TX_DIS LL_GPIO_ResetOutputPin(RS485_GPIO, RS485_GPIO_Pin);
#define RS485_GPIO GPIOA
#define RS485_GPIO_Pin LL_GPIO_PIN_11
#define Modbus_UART USART1
#define Modbus_TIM TIM2
#endif
#ifdef CURRENT_OPERATION_MODE_TCP
#define DEFAULT_TCP_MODBUS_SOCKET 1
#endif
#endif