Here is my understanding. The RSSI returned by CC2420 is a negative number.
Since CC2420Control returns an unsigned number, it needs to translate the raw
RSSI to a positive number. On the other hand, CC2420Packet returns a signed
number, so it can just return.
Mike
On Mar 23, 2010, at 4:36 AM, wx li wrote:
> hi,guys.
> I am trying to access the hardware noise floor with tinyos-2.x
> I am confused about the code in Module "CC2420ControlP.nc"
>
> event void RssiResource.granted() {
> uint16_t data;
> call CSN.clr();
> call RSSI.read(&data);
> call CSN.set();
>
> call RssiResource.release();
> data += 0x7f;
> data &= 0x00ff;
> signal ReadRssi.readDone(SUCCESS, data);
> }
>
> Here, i don't know why the var data should be added by 0x7F
> And, in Module "CC2420PacketC.nc"
>
> async command int8_t CC2420Packet.getRssi( message_t* p_msg ) {
> return (call CC2420PacketBody.getMetadata( p_msg ))->rssi;
> }
>
> Here, it just read the rssi value in metadata, and do not plus 0x7f
> I've been searching for the answer for a couple of hours. But without luck
> yet..
> Thank you for all your help!
>
> Regard,
> Nathan
> 3.23.2010
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help