The problem is a C problem - you have to declare a variable - *rcvpkt *in
the beginning of a scope.
Rewrite as follows:
.....
if (len == sizeof(Msg)) {
Msg* rcvpkt = (Msg*)payload; <- First
local_time = ((stop_time * over) - start_time);
..........
On Tue, Dec 22, 2009 at 21:07, Srinivas Hegde <[email protected]>wrote:
> Hi,
> I have written a code that gets the local time at start and stop of each
> radio period in MSp430PowerCycleP.nc. I would like to use these variables in
> my application code to find the actual ON time of the radio. But, the extern
> gives me error
>
> implementation {
>
> extern uint32_t stop_time;
> extern uint32_t start_time;
> extern uint8_t over;
> uint32_t local_time[2];
>
> .......
>
> event message_t* Receive.receive(message_t* msg, void* payload, uint8_t
> len) {
>
> call Leds.led2Toggle();
>
> if (len == sizeof(Msg)) {
> local_time = ((stop_time * over) - start_time);
>
> Msg* rcvpkt = (Msg*)payload; <--- Line no 127
>
> ..........
>
> I am getting the following error:
> In component `CommC':
> CommC.nc: In function `Receive.receive':
> CommC.nc:127: syntax error before `*'
> CommC.nc:131: `srlpkt' undeclared (first use in this function)
> CommC.nc:131: (Each undeclared identifier is reported only once
> CommC.nc:131: for each function it appears in.)
> CommC.nc:131: `rcvpkt' undeclared (first use in this function)
>
> The code works fine if I remove the following line:
> local_time = ((stop_time * over) - start_time);
>
> I think there is some error in the extern variables usage. Can you please
> help me with that.
>
> Thanks,
> Srinivas Hegde
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
--
Best Regards,
Arik Sapojnik
[email protected]
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help