35 lines
868 B
C
35 lines
868 B
C
|
|
#ifndef __MODBUS_RTU_MASTER_H
|
||
|
|
#define __MODBUS_RTU_MASTER_H
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
extern "C" {
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#include "stm32f1xx_hal.h"
|
||
|
|
|
||
|
|
#define MODBUS_RTU_SLAVE_ADDR 1
|
||
|
|
#define MODBUS_RTU_TARGET_REG 1160
|
||
|
|
#define MODBUS_RTU_REG_QTY 1
|
||
|
|
#define MODBUS_RTU_POLL_INTERVAL 1000
|
||
|
|
#define MODBUS_RTU_RESP_TIMEOUT 500
|
||
|
|
#define MODBUS_RTU_INTER_CHAR_TIMEOUT 10
|
||
|
|
#define MODBUS_RTU_TX_ECHO_MARGIN 10
|
||
|
|
|
||
|
|
#define NORIS_FIRE_ALARM(reg) (((reg) >> 4) & 0x01)
|
||
|
|
#define NORIS_DOOR_ALARM(reg) (((reg) >> 5) & 0x01)
|
||
|
|
#define NORIS_BILGE_ALARM(reg) (((reg) >> 6) & 0x01)
|
||
|
|
#define NORIS_GAS_ALARM(reg) (((reg) >> 7) & 0x01)
|
||
|
|
|
||
|
|
#define MODBUS_RTU_MAX_RX_BUF 64
|
||
|
|
|
||
|
|
void ModbusRTU_Master_Init(void);
|
||
|
|
void ModbusRTU_Master_Task(void);
|
||
|
|
void ModbusRTU_FeedRxByte(uint8_t byte);
|
||
|
|
uint8_t ModbusRTU_GetAlarmState(void);
|
||
|
|
|
||
|
|
#ifdef __cplusplus
|
||
|
|
}
|
||
|
|
#endif
|
||
|
|
|
||
|
|
#endif
|