Serial Port with Timeout using Timer Event

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Serial Port with Timeout using Timer Event

935件の閲覧回数
waynetaylor
Contributor II

Many people have asked about solutions for adding timeouts to the fgetc() blocking function. How about using a timer event to restart the task that called fgetc()? I don't know how to do it, but I think it might have something to do with _taskq_resume().

Has anyone used task queues.

Wayne

1 返信

739件の閲覧回数
Carlos_Musich
NXP Employee
NXP Employee

Hi Wayne,

If you want the task to exit form fgetc() and continue you would need to modify the bsp. But if you dont have problem on restarting the task you may use a timer as you say.

In MQX installation you can find hwtimer and timer examples. C:\Freescale\Freescale_MQX_4_2\mqx\examples

You can also use lwtimer.

For restarting the task you need _task_restart()

E.g.

_task_id uart_task_id;

uart_task_id = _task_create(0, UART_TASK, 0);

_task_restart(uart_task_id, NULL, 0);

Best regards,

Carlos

0 件の賞賛
返信