I try to send data from A process to B process with contiki-NG and firefly.
This is sender part of A process
PROCESS_THREAD(A_process, ev, data)
{
...
int data=1;
if(process_post(&led_example, PROCESS_EVENT_CONTINUE, &data_led)!=PROCESS_ERR_OK){
printf("event could not be posted\n");
}
...
}
This is receiver part of B process
PROCESS_THREAD(B_process, ev, data)
{
...
if(ev==PROCESS_EVENT_CONTINUE ){
printf("data=%d",*(int*)data);
}
...
}
I checked event is delivered well.
But problem is the data.
I expected that B process print "data=1" but print garbage value ("data=2118363").
(I know process_data_t
is void*
(void pointer))
How can I get right value? Thank you.
Try declaring like :