Skip to content

Commit 830975f

Browse files
authored
Merge pull request #1750 from shauew/patch-2
Update portserial_m.c
2 parents eada505 + 4fb344e commit 830975f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

components/net/freemodbus/port/portserial_m.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,16 @@ void vMBMasterPortSerialEnable(BOOL xRxEnable, BOOL xTxEnable)
130130
/* enable RX interrupt */
131131
serial->ops->control(serial, RT_DEVICE_CTRL_SET_INT, (void *)RT_DEVICE_FLAG_INT_RX);
132132
/* switch 485 to receive mode */
133+
#if defined(RT_MODBUS_MASTER_USE_CONTROL_PIN)
133134
rt_pin_write(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_LOW);
135+
#endif
134136
}
135137
else
136138
{
137139
/* switch 485 to transmit mode */
140+
#if defined(RT_MODBUS_MASTER_USE_CONTROL_PIN)
138141
rt_pin_write(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_HIGH);
142+
#endif
139143
/* disable RX interrupt */
140144
serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void *)RT_DEVICE_FLAG_INT_RX);
141145
}

0 commit comments

Comments
 (0)