Loading...
Searching...
No Matches
__modbus_compat.h
Go to the documentation of this file.
/**
*******************************************************************************
* @file __modbus_compat.h
* @brief Модуль для совместимости библиотеки MODBUS.
*******************************************************************************
* @details Файл содержит API старых функций, а также заглушки для отключенных модулей:
******************************************************************************/
#include "modbus_core.h"
/** @addtogroup MODBUS_LEGACY_API Legacy API
* @ingroup MODBUS_FUNCTIONS
* @brief Старые API функций, сохранённые для обратной совместимости.
* @note Не используйте эти функции в новом коде. Они могут быть удалены в будущих версиях.
* Вместо них используйте функции из основных групп MODBUS API.
* @{
*/
/** MODBUS_LEGACY_API
* @}
*/
/** @cond Заглушки отключенных модулей */
#ifndef MODBUS_ENABLE_COILS
#define MB_Coil_Write_Global(Addr, WriteVal) ET_ILLEGAL_FUNCTION
#define MB_Coil_Read_Global(Addr, Exception) 0
#define MB_Process_Read_Coils(modbus_msg) 0
#define MB_Process_Write_Single_Coil(modbus_msg) 0
#define MB_Process_Write_Miltuple_Coils(modbus_msg) 0
#endif
#ifndef MODBUS_ENABLE_HOLDINGS
#define MB_Holding_Write_Global(Addr, WriteVal) ET_ILLEGAL_FUNCTION
#define MB_Holding_Read_Global(Addr, Exception) 0
#define MB_Process_Read_Hold_Regs(modbus_msg) 0
#define MB_Process_Write_Single_Reg(modbus_msg) 0
#define MB_Process_Write_Miltuple_Regs(modbus_msg) 0
#endif
#ifndef MODBUS_ENABLE_INPUTS
#define MB_Input_Write_Global(Addr, WriteVal) ET_ILLEGAL_FUNCTION
#define MB_Input_Read_Global(Addr, Exception) 0
#define MB_Process_Read_Input_Regs(modbus_msg) 0
#endif
#ifndef MODBUS_ENABLE_DEVICE_IDENTIFICATIONS
#define MB_WriteSingleObjectToMessage(mbdata, ind, obj)
#define MB_WriteObjectsToMessage(modbus_msg, maxidofobj)
#define MB_Process_Read_Device_Identifications(modbus_msg) 0
#define MB_DeviceInentificationInit()
#endif
#ifndef MODBUS_ENABLE_DIAGNOSTICS
#define MB_DiagnosticsInit()
#define MB_Diagnostics_WriteBit(bit_num, bit_state) 0
#define MB_Diagnostics_GetBit(bit_num) 0
#define MB_Process_Diagnostics(modbus_msg) 0
#define MB_Diagnostics_BusMessageCnt()
#define MB_Diagnostics_CommunicationErrorCnt()
#define MB_Diagnostics_ExceptionErrorCnt()
#define MB_Diagnostics_CharacterOverrunCnt()
#define MB_Diagnostics_SlaveMessageCnt()
#define MB_Diagnostics_SlaveNoResponseCnt()
#define MB_Diagnostics_SlaveNAKCnt()
#define MB_Diagnostics_SlaveBusyCnt()
#define MB_GetDeviceMode(void) MODBUS_NORMAL_MODE
#endif
#ifndef MODBUS_ENABLE_MASTER
#define MB_RespGet_RegisterValue(modbus_msg, reg_addr, reg_value) 0
#define MB_RespGet_CoilState(modbus_msg, coil_addr, coil_state) 0
#define MB_RespGet_NumberOfObjects(modbus_msg) 0
#define MB_RespGet_ObjectById(modbus_msg, obj_id, obj_data, obj_length) 0
#define MB_RespGet_ObjectByIndex(modbus_msg, index, obj_id, obj_data, obj_length) 0
#define MB_RespGet_Diagnostic(modbus_msg, data) 0
#define MB_REQUEST_READ_COILS(slave_addr, start_addr, quantity) {0}
#define MB_REQUEST_READ_DISCRETE_INPUTS(slave_addr, start_addr, quantity) {0}
#define MB_REQUEST_READ_HOLDING_REGS(slave_addr, start_addr, quantity) {0}
#define MB_REQUEST_READ_INPUT_REGS(slave_addr, start_addr, quantity) {0}
#define MB_REQUEST_WRITE_SINGLE_COIL(slave_addr, coil_addr, value) {0}
#define MB_REQUEST_WRITE_SINGLE_REG(slave_addr, reg_addr, value) {0}
#define MB_REQUEST_WRITE_MULTIPLE_COILS(slave_addr, start_addr, quantity, coils_data) {0}
#define MB_REQUEST_WRITE_MULTIPLE_REGS(slave_addr, start_addr, quantity, regs_data) {0}
#define MB_REQUEST_DIAGNOSTIC_QUERY(slave_addr, sub_function, data) {0}
#define MB_REQUEST_RETURN_QUERY_DATA(slave_addr) {0}
#define MB_REQUEST_RESTART_COMMUNICATIONS(slave_addr, data) {0}
#define MB_REQUEST_RETURN_DIAGNOSTIC_REGISTER(slave_addr) {0}
#define MB_REQUEST_FORCE_LISTEN_ONLY_MODE(slave_addr) {0}
#define MB_REQUEST_CLEAR_COUNTERS_AND_DIAGNOSTIC_REGISTER(slave_addr) {0}
#define MB_REQUEST_RETURN_BUS_MESSAGE_COUNT(slave_addr) {0}
#define MB_REQUEST_RETURN_BUS_COMMUNICATION_ERROR_COUNT(slave_addr) {0}
#define MB_REQUEST_RETURN_SLAVE_EXCEPTION_ERROR_COUNT(slave_addr) {0}
#define MB_REQUEST_RETURN_SLAVE_MESSAGE_COUNT(slave_addr) {0}
#define MB_REQUEST_RETURN_SLAVE_NO_RESPONSE_COUNT(slave_addr) {0}
#define MB_REQUEST_RETURN_SLAVE_NAK_COUNT(slave_addr) {0}
#define MB_REQUEST_RETURN_SLAVE_BUSY_COUNT(slave_addr) {0}
#define MB_REQUEST_RETURN_BUS_CHARACTER_OVERRUN_COUNT(slave_addr) {0}
#define MB_REQUEST_READ_DEVICE_ID_BASIC(slave_addr) {0}
#define MB_REQUEST_READ_DEVICE_ID_REGULAR(slave_addr) {0}
#define MB_REQUEST_READ_DEVICE_ID_EXTENDED(slave_addr) {0}
#define MB_REQUEST_READ_DEVICE_ID_SPECIFIC(slave_addr, object_id) {0}
#define MB_Master_Collect_Message(hmodbus, modbus_msg, modbus_uart_buff) RS_ERR
#define MB_Master_Parse_Message(hmodbus, modbus_msg, modbus_uart_buff) RS_ERR
#endif
#ifndef MODBUS_ENABLE_SLAVE
#define MB_Slave_Response(hmodbus, modbus_msg) RS_ERR
#define MB_Slave_Collect_Message(hmodbus, modbus_msg, modbus_uart_buff) RS_ERR
#define MB_Slave_Parse_Message(hmodbus, modbus_msg, modbus_uart_buff) RS_ERR
#endif
/** @endcond */
modbus_core.h
Ядро Modbus протокола - определения и структуры