Skip to content

Commit

Permalink
1、【优化】移植部分的定时器配置及其他细节处理,提高可靠性;
Browse files Browse the repository at this point in the history
Signed-off-by: armink <[email protected]>
  • Loading branch information
armink committed Apr 11, 2017
1 parent 7317c18 commit fcc2228
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion APP/inc/rtconfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#define RT_USING_HOOK

/* Using Software Timer */
/* #define RT_USING_TIMER_SOFT */
#define RT_USING_TIMER_SOFT
#define RT_TIMER_THREAD_PRIO 4
#define RT_TIMER_THREAD_STACK_SIZE 512
#define RT_TIMER_TICK_PER_SECOND 1000
Expand Down
2 changes: 1 addition & 1 deletion FreeModbus/port/rtt/portserial.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ BOOL xMBPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
}

/* software initialize */
rt_event_init(&event_serial, "slave event", RT_IPC_FLAG_PRIO);
rt_thread_init(&thread_serial_soft_trans_irq,
"slave trans",
serial_soft_trans_irq,
Expand All @@ -115,7 +116,6 @@ BOOL xMBPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
sizeof(serial_soft_trans_irq_stack),
10, 5);
rt_thread_startup(&thread_serial_soft_trans_irq);
rt_event_init(&event_serial, "slave event", RT_IPC_FLAG_PRIO);

return TRUE;
}
Expand Down
2 changes: 1 addition & 1 deletion FreeModbus/port/rtt/portserial_m.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ BOOL xMBMasterPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
}

/* software initialize */
rt_event_init(&event_serial, "master event", RT_IPC_FLAG_PRIO);
rt_thread_init(&thread_serial_soft_trans_irq,
"master trans",
serial_soft_trans_irq,
Expand All @@ -116,7 +117,6 @@ BOOL xMBMasterPortSerialInit(UCHAR ucPORT, ULONG ulBaudRate, UCHAR ucDataBits,
sizeof(serial_soft_trans_irq_stack),
10, 5);
rt_thread_startup(&thread_serial_soft_trans_irq);
rt_event_init(&event_serial, "master event", RT_IPC_FLAG_PRIO);

return TRUE;
}
Expand Down
2 changes: 1 addition & 1 deletion FreeModbus/port/rtt/porttimer.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ BOOL xMBPortTimersInit(USHORT usTim1Timerout50us)
rt_timer_init(&timer, "slave timer",
timer_timeout_ind, /* bind timeout callback function */
RT_NULL,
(50*usTim1Timerout50us)/(1000*1000/RT_TICK_PER_SECOND),
(50 * usTim1Timerout50us) / (1000 * 1000 / RT_TICK_PER_SECOND) + 1,
RT_TIMER_FLAG_ONE_SHOT); /* one shot */
return TRUE;
}
Expand Down
2 changes: 1 addition & 1 deletion FreeModbus/port/rtt/porttimer_m.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ BOOL xMBMasterPortTimersInit(USHORT usTimeOut50us)
rt_timer_init(&timer, "master timer",
timer_timeout_ind, /* bind timeout callback function */
RT_NULL,
(50 * usT35TimeOut50us) / (1000 * 1000 / RT_TICK_PER_SECOND),
(50 * usT35TimeOut50us) / (1000 * 1000 / RT_TICK_PER_SECOND) + 1,
RT_TIMER_FLAG_ONE_SHOT); /* one shot */

return TRUE;
Expand Down

0 comments on commit fcc2228

Please sign in to comment.