Explorar el Código

Update portserial_m.c

sorry, miss out other two parts.
shauew hace 7 años
padre
commit
4fb344e759
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  1. 4 0
      components/net/freemodbus/port/portserial_m.c

+ 4 - 0
components/net/freemodbus/port/portserial_m.c

@@ -130,12 +130,16 @@ void vMBMasterPortSerialEnable(BOOL xRxEnable, BOOL xTxEnable)
         /* enable RX interrupt */
         serial->ops->control(serial, RT_DEVICE_CTRL_SET_INT, (void *)RT_DEVICE_FLAG_INT_RX);
         /* switch 485 to receive mode */
+#if defined(RT_MODBUS_MASTER_USE_CONTROL_PIN)
         rt_pin_write(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_LOW);
+#endif
     }
     else
     {
         /* switch 485 to transmit mode */
+#if defined(RT_MODBUS_MASTER_USE_CONTROL_PIN)
         rt_pin_write(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_HIGH);
+#endif
         /* disable RX interrupt */
         serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void *)RT_DEVICE_FLAG_INT_RX);
     }