How to pass arguments to thread ?

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

How to pass arguments to thread ?

557件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mondo90 on Fri Sep 26 06:55:03 MST 2014
Hello, I need information how to pass arguments to thread function. Like below, how to pass args to vTaskLEDBlinker function ?

xTaskCreate( vTaskLEDBlinker, (const signed portCHAR * const) "while", configMINIMAL_STACK_SIZE,
NULL, 3, NULL);


can I writte it as :

xTaskCreate( vTaskLEDBlinker(arg1,arg2), (const signed portCHAR * const) "while", configMINIMAL_STACK_SIZE,
NULL, 3, NULL);



Thanks for help.
0 件の賞賛
返信
2 返答(返信)

547件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by Mondo90 on Fri Sep 26 07:59:32 MST 2014
Thanks, good resource. I

have other questions: I have a light intensity project which flash leds respectivaly to light inetnsity like below:

while(1) {
....
if (adc_volt > 220){
led_on_of(1,1);
}else{led_on_of(1,0);led_on_of(2,0);led_on_of(3,0);led_on_of(4,0);}
if (adc_volt > 250){
led_on_of(2,1);
}else{led_on_of(2,0);led_on_of(3,0);led_on_of(4,0);} 

...
}

1.) Is it good idea to open new thread for each led_of_of function ?
2.) What is an adventage of use thread instead of just function call ?
3.) Should I delete threads after their job ?
4.) In general when should we use Threads ?


Thanks.
0 件の賞賛
返信

547件の閲覧回数
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by gnxp on Fri Sep 26 07:00:46 MST 2014
You should start here. The link describes how to do it.

http://www.freertos.org/a00125.html
0 件の賞賛
返信