CC2530获取RSSI
在裸机情况下,两个CC2530可以通信,但是不知道该如何获取RSSI值,请大神帮帮忙
逻机可以参考如下代码,里面已经有考虑如何获取RSSI。代码里搜rxi.rssi, 里面也有对rssi的校准。参考如下接收函数
http://www.ti.com/lit/zip/swrc135
uint8 basicRfReceive(uint8* pRxData, uint8 len, int16* pRssi)
{
// Accessing shared variables -> this is a critical region
// Critical region start
halIntOff();
memcpy(pRxData, rxi.pPayload, min(rxi.length, len));
if(pRssi != NULL) {
if(rxi.rssi < 128){
*pRssi = rxi.rssi - halRfGetRssiOffset();
}
else{
*pRssi = (rxi.rssi - 256) - halRfGetRssiOffset();
}
}
rxi.isReady = FALSE;
halIntOn();
// Critical region end
return min(rxi.length, len);
}
uint8 basicRfReceive(uint8* pRxData, uint8 len, int16* pRssi)
{
// Accessing shared variables -> this is a critical region
// Critical region start
halIntOff();
memcpy(pRxData, rxi.pPayload, min(rxi.length, len));
if(pRssi != NULL) {
if(rxi.rssi < 128){
*pRssi = rxi.rssi - halRfGetRssiOffset();
}
else{
*pRssi = (rxi.rssi - 256) - halRfGetRssiOffset();
}
}
rxi.isReady = FALSE;
halIntOn();
// Critical region end
return min(rxi.length, len);
}