Should the thread function be typed a 'msg_t' or a 'tfunc_t'. All the demo programs are typed 'msg_t' but I am getting the error:
myMisc.c:353:5: warning: passing argument 4 of 'chThdCreateStatic' from incompatible pointer type [enabled by default]
C:\ChibiStudio\chibios/os/kernel/include/chthreads.h:356:11: note: expected 'tfunc_t' but argument is of type 'msg_t (*)(char *)'
Line 353 is the chThdCreateStatic line.
This is working just fine for other thread functions in this program...
--------------------------------------------------------------
static WORKING_AREA(waSendMorse, 128);
static msg_t SendMorse(char *msg)
{
uint8_t j;
chRegSetThreadName("SendMorse");
while(TRUE)
{
for ( j=0; j<strlen(msg); j++)
{
send(msg[j]); // Send each character in the message.
}
}
return 0;
}
void startMorse( char *msg)
{
// Start SendMorse thread and send pointer of messsage we want to send
chThdCreateStatic(waSendMorse, sizeof(waSendMorse), NORMALPRIO, SendMorse, msg);
}
Thanks
-John
Thread function 'tfunc_t' or 'msg_t'?
Moderators: RoccoMarco, lbednarz, tfAteba
- Giovanni
- Site Admin
- Posts: 14895
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 997 times
Re: Thread function 'tfunc_t' or 'msg_t'?
Hi,
The type of a thread function is tfunc_t, msg_t is used for messages and is also the return type of a tfunc_t.
Giovanni
The type of a thread function is tfunc_t, msg_t is used for messages and is also the return type of a tfunc_t.
Giovanni