diff --git a/components/net/freemodbus-v1.6.0/port/port.c b/components/net/freemodbus-v1.6.0/port/port.c index 527af909acfc70b322bd9f89932dd2c6cc2ca7d9..d01c5c9d6a7ecc00b61e3501ea2912f153c229a1 100644 --- a/components/net/freemodbus-v1.6.0/port/port.c +++ b/components/net/freemodbus-v1.6.0/port/port.c @@ -16,7 +16,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * - * File: $Id: portevent.c,v 1.60 2015/02/01 9:18:05 Armink $ + * File: $Id: port.c,v 1.60 2015/02/01 9:18:05 Armink $ */ /* ----------------------- System includes --------------------------------*/ @@ -28,11 +28,11 @@ static rt_base_t level; /* ----------------------- Start implementation -----------------------------*/ void EnterCriticalSection(void) { - level = rt_hw_interrupt_disable(); + level = rt_hw_interrupt_disable(); } void ExitCriticalSection(void) { - rt_hw_interrupt_enable(level); + rt_hw_interrupt_enable(level); } diff --git a/components/net/freemodbus-v1.6.0/port/port.h b/components/net/freemodbus-v1.6.0/port/port.h index 92056116b891b598f13bb4ddf983e66ae060ed59..73d2177c9a36769d11d31bb200b393bbea3d495e 100644 --- a/components/net/freemodbus-v1.6.0/port/port.h +++ b/components/net/freemodbus-v1.6.0/port/port.h @@ -30,11 +30,11 @@ #include #include -#define INLINE +#define INLINE #define PR_BEGIN_EXTERN_C extern "C" { -#define PR_END_EXTERN_C } +#define PR_END_EXTERN_C } -#define ENTER_CRITICAL_SECTION() EnterCriticalSection() +#define ENTER_CRITICAL_SECTION() EnterCriticalSection() #define EXIT_CRITICAL_SECTION() ExitCriticalSection() typedef uint8_t BOOL; diff --git a/components/net/freemodbus-v1.6.0/port/portserial.c b/components/net/freemodbus-v1.6.0/port/portserial.c index 3a5f8eab62fe740d598dbaff5f759c562f117c83..317c7f4605264f33ff0eb183b944df6709264fba 100644 --- a/components/net/freemodbus-v1.6.0/port/portserial.c +++ b/components/net/freemodbus-v1.6.0/port/portserial.c @@ -133,7 +133,7 @@ void vMBPortSerialEnable(BOOL xRxEnable, BOOL xTxEnable) else { /* switch 485 to transmit mode */ - rt_pin_write(MODBUS_SLAVE_RT_CONTROL_PIN_INDEX, PIN_HIGH); + rt_pin_write(MODBUS_SLAVE_RT_CONTROL_PIN_INDEX, PIN_HIGH); /* disable RX interrupt */ serial->ops->control(serial, RT_DEVICE_CTRL_CLR_INT, (void *)RT_DEVICE_FLAG_INT_RX); } diff --git a/components/net/freemodbus-v1.6.0/port/portserial_m.c b/components/net/freemodbus-v1.6.0/port/portserial_m.c index 6c3d4c8299ef5adf01361d42b60ddb88d709aeca..8ec0d081f1baa424037a400cc5cb37466e0e9469 100644 --- a/components/net/freemodbus-v1.6.0/port/portserial_m.c +++ b/components/net/freemodbus-v1.6.0/port/portserial_m.c @@ -57,7 +57,7 @@ BOOL xMBMasterPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits, * set 485 mode receive and transmit control IO * @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 */ if (ucPORT == 1) { @@ -129,12 +129,12 @@ 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 */ - rt_pin_write(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_LOW); + rt_pin_write(MODBUS_MASTER_RT_CONTROL_PIN_INDEX, PIN_LOW); } else { /* 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 */ 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) { - serial->parent.close(&(serial->parent)); + serial->parent.close(&(serial->parent)); } BOOL xMBMasterPortSerialPutByte(CHAR ucByte) { serial->parent.write(&(serial->parent), 0, &ucByte, 1); - return TRUE; + return TRUE; } BOOL xMBMasterPortSerialGetByte(CHAR * pucByte) diff --git a/components/net/freemodbus-v1.6.0/port/porttimer_m.c b/components/net/freemodbus-v1.6.0/port/porttimer_m.c index 69bdc5487937268fab4a05290f5b5f80fefd98ee..00441bfd1cb16e22dd494bd33f0b721777abf32e 100644 --- a/components/net/freemodbus-v1.6.0/port/porttimer_m.c +++ b/components/net/freemodbus-v1.6.0/port/porttimer_m.c @@ -54,44 +54,44 @@ BOOL xMBMasterPortTimersInit(USHORT usTimeOut50us) void vMBMasterPortTimersT35Enable() { - rt_tick_t timer_tick = (50 * usT35TimeOut50us) - / (1000 * 1000 / RT_TICK_PER_SECOND); + rt_tick_t timer_tick = (50 * usT35TimeOut50us) + / (1000 * 1000 / RT_TICK_PER_SECOND); /* Set current timer mode, don't change it.*/ vMBMasterSetCurTimerMode(MB_TMODE_T35); - rt_timer_control(&timer, RT_TIMER_CTRL_SET_TIME, &timer_tick); + rt_timer_control(&timer, RT_TIMER_CTRL_SET_TIME, &timer_tick); rt_timer_start(&timer); } void vMBMasterPortTimersConvertDelayEnable() { - rt_tick_t timer_tick = MB_MASTER_DELAY_MS_CONVERT * RT_TICK_PER_SECOND / 1000; + rt_tick_t timer_tick = MB_MASTER_DELAY_MS_CONVERT * RT_TICK_PER_SECOND / 1000; /* Set current timer mode, don't change it.*/ vMBMasterSetCurTimerMode(MB_TMODE_CONVERT_DELAY); - rt_timer_control(&timer, RT_TIMER_CTRL_SET_TIME, &timer_tick); + rt_timer_control(&timer, RT_TIMER_CTRL_SET_TIME, &timer_tick); rt_timer_start(&timer); } void vMBMasterPortTimersRespondTimeoutEnable() { - rt_tick_t timer_tick = MB_MASTER_TIMEOUT_MS_RESPOND * RT_TICK_PER_SECOND / 1000; + rt_tick_t timer_tick = MB_MASTER_TIMEOUT_MS_RESPOND * RT_TICK_PER_SECOND / 1000; /* Set current timer mode, don't change it.*/ vMBMasterSetCurTimerMode(MB_TMODE_RESPOND_TIMEOUT); - rt_timer_control(&timer, RT_TIMER_CTRL_SET_TIME, &timer_tick); + rt_timer_control(&timer, RT_TIMER_CTRL_SET_TIME, &timer_tick); rt_timer_start(&timer); } void vMBMasterPortTimersDisable() { - rt_timer_stop(&timer); + rt_timer_stop(&timer); } void prvvTIMERExpiredISR(void) diff --git a/components/net/freemodbus-v1.6.0/port/user_mb_app.c b/components/net/freemodbus-v1.6.0/port/user_mb_app.c index e6fdede11fee32ac168ec9fb62a3234489afde52..8da7376336d0506fa04f0ccd02aa9948985bcf5b 100644 --- a/components/net/freemodbus-v1.6.0/port/user_mb_app.c +++ b/components/net/freemodbus-v1.6.0/port/user_mb_app.c @@ -260,8 +260,8 @@ eMBErrorCode eMBRegDiscreteCB( UCHAR * pucRegBuffer, USHORT usAddress, USHORT us if ((usAddress >= DISCRETE_INPUT_START) && (usAddress + usNDiscrete <= DISCRETE_INPUT_START + DISCRETE_INPUT_NDISCRETES)) { - iRegIndex = (USHORT) (usAddress - usDiscreteInputStart) / 8; //每个寄存器存8个 - iRegBitIndex = (USHORT) (usAddress - usDiscreteInputStart) % 8; //相对于寄存器内部的位地址 + iRegIndex = (USHORT) (usAddress - usDiscreteInputStart) / 8; + iRegBitIndex = (USHORT) (usAddress - usDiscreteInputStart) % 8; while (iNReg > 0) {