42 lines
826 B
C
42 lines
826 B
C
/*
|
|
* rtuMaster.h
|
|
*
|
|
* Created on: Mar 26, 2026
|
|
* Author: 18896
|
|
*/
|
|
|
|
#ifndef RTUMASTER_H_
|
|
#define RTUMASTER_H_
|
|
|
|
#define RE_SET HAL_GPIO_WritePin(re485_GPIO_Port, re485_Pin, GPIO_PIN_SET)
|
|
#define RE_RESET HAL_GPIO_WritePin(re485_GPIO_Port, re485_Pin, GPIO_PIN_RESET)
|
|
|
|
typedef struct {
|
|
uint16_t slave_id;
|
|
uint16_t slave_address;
|
|
uint16_t plc_address;
|
|
uint16_t size;
|
|
} rtumST;
|
|
|
|
typedef struct {
|
|
uint8_t plc_type;
|
|
_Bool isMaster;
|
|
_Bool rxdone;
|
|
uint16_t rxsize, txsize;
|
|
uint16_t timeout;
|
|
uint8_t rxbuf[255];
|
|
uint8_t txbuf[255];
|
|
uint16_t localSlaveId;
|
|
uint16_t localStartIdx;
|
|
} RtuMaster;
|
|
|
|
extern rtumST readST[10];
|
|
extern rtumST writeST[10];
|
|
extern rtumST myRtumST[20];
|
|
extern RtuMaster master;
|
|
|
|
void initRtuMaster();
|
|
void RTU_Master_Loop();
|
|
|
|
#endif /* RTUMASTER_H_ */
|