|
@@ -57,7 +57,7 @@ BOOL xMBMasterPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
|
|
* set 485 mode receive and transmit control IO
|
|
* set 485 mode receive and transmit control IO
|
|
* @note MODBUS_MASTER_RT_CONTROL_PIN_INDEX need be defined by user
|
|
* @note MODBUS_MASTER_RT_CONTROL_PIN_INDEX need be defined by user
|
|
*/
|
|
*/
|
|
- rt_pin_mode(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_MODE_OUTPUT);
|
|
|
|
|
|
+ rt_pin_mode(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_MODE_OUTPUT);
|
|
|
|
|
|
/* set serial name */
|
|
/* set serial name */
|
|
if (ucPORT == 1) {
|
|
if (ucPORT == 1) {
|
|
@@ -129,12 +129,12 @@ void vMBMasterPortSerialEnable(BOOL xRxEnable, BOOL xTxEnable)
|
|
/* enable RX interrupt */
|
|
/* enable RX interrupt */
|
|
serial->ops->control(serial, RT_DEVICE_CTRL_SET_INT, (void *)RT_DEVICE_FLAG_INT_RX);
|
|
serial->ops->control(serial, RT_DEVICE_CTRL_SET_INT, (void *)RT_DEVICE_FLAG_INT_RX);
|
|
/* switch 485 to receive mode */
|
|
/* switch 485 to receive mode */
|
|
- rt_pin_write(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_LOW);
|
|
|
|
|
|
+ rt_pin_write(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_LOW);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
/* switch 485 to transmit mode */
|
|
/* switch 485 to transmit mode */
|
|
- rt_pin_write(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_HIGH);
|
|
|
|
|
|
+ rt_pin_write(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_HIGH);
|
|
/* disable RX interrupt */
|
|
/* disable RX interrupt */
|
|
serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void *)RT_DEVICE_FLAG_INT_RX);
|
|
serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void *)RT_DEVICE_FLAG_INT_RX);
|
|
}
|
|
}
|
|
@@ -154,13 +154,13 @@ void vMBMasterPortSerialEnable(BOOL xRxEnable, BOOL xTxEnable)
|
|
|
|
|
|
void vMBMasterPortClose(void)
|
|
void vMBMasterPortClose(void)
|
|
{
|
|
{
|
|
- serial->parent.close(&(serial->parent));
|
|
|
|
|
|
+ serial->parent.close(&(serial->parent));
|
|
}
|
|
}
|
|
|
|
|
|
BOOL xMBMasterPortSerialPutByte(CHAR ucByte)
|
|
BOOL xMBMasterPortSerialPutByte(CHAR ucByte)
|
|
{
|
|
{
|
|
serial->parent.write(&(serial->parent), 0, &ucByte, 1);
|
|
serial->parent.write(&(serial->parent), 0, &ucByte, 1);
|
|
- return TRUE;
|
|
|
|
|
|
+ return TRUE;
|
|
}
|
|
}
|
|
|
|
|
|
BOOL xMBMasterPortSerialGetByte(CHAR * pucByte)
|
|
BOOL xMBMasterPortSerialGetByte(CHAR * pucByte)
|