📄 rfreceivepacket.c
字号:
/******************************************************************************
* *
* ********** *
* ************ *
* *** *** *
* *** ++ *** *
* *** + + *** CHIPCON *
* *** + *
* *** + + *** *
* *** ++ *** *
* *** *** *
* ************ *
* ********** *
* *
*******************************************************************************
Filename: rfReceivePacket.c
Target: cc2430
Author: EFU
Revised: 16/12-2005
Revision: 1.0
******************************************************************************/
#include "hal.h"
BYTE volatile length;
//-----------------------------------------------------------------------------
// See hal.h for a description of this function.
//-----------------------------------------------------------------------------
BYTE halRfReceivePacket(BYTE* pData, BYTE* pRssi, BYTE* pLqi, BYTE timeOut){
BYTE i = 0x00;
ISFLUSHRX; // Making sure that the rX FIFO is empty.
ISFLUSHRX; // Issuing the command twice to reset the SFD.
RFIF &= ~IRQ_FIFOP;
// Turning on RX
ISRXON;
while(!(RFIF & IRQ_FIFOP))
{
if(timeOut)
{
halWait(1);
timeOut--;
}
else
{
return 0;
}
}
length = (RFD & 0x7F);
// Storing packet
for(i=0; i<(length-2); i++){
pData[i] = RFD;
}
*pRssi = RFD;
*pLqi = RFD;
// Last two bytes contain RSSI level and Correlation value in addition to CRC OK.
// Checking that the CRC value is OK
if(*pLqi & 0x80){
return i;
}
else {
return 0;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -