And the following is the code of operation to FIFO:
UINT8 j;
BYTE status[2];
halSpiStrobe(CCxxx0_SRX);
Dly1mS(1);
if(halSpiReadStatus(CCxxx0_RXBYTES)==0)
{
return 0;
}
Dly1mS(2);
j=length*90;
while((halSpiReadStatus(CCxxx0_MARCSTATE)&0x1f)!=0x01)
{
Dly1mS(1);
j--;
if(!j)
{
halSpiStrobe(CCxxx0_SIDLE);
halSpiStrobe(CCxxx0_SFRX);
return 0;
}
}
PacketLength = halSpiReadReg(CCxxx0_RXFIFO);
if((PacketLength < RFRXBUFLEN) && (PacketLength > 0))
{
rxBuffer[0] = PacketLength;
halSpiReadBurstReg(CCxxx0_RXFIFO, &rxBuffer[1], PacketLength);
// Read the 2 appended status bytes (status[0] = RSSI, status[1] = LQI)
halSpiReadBurstReg(CCxxx0_RXFIFO, status, 2);
g_RevRSSI = status[0];
return (status[1] & CRC_OK);
}
else if(PacketLength >= RFRXBUFLEN)
{
halSpiStrobe(CCxxx0_SIDLE);
halSpiStrobe(CCxxx0_SFRX);
return 0;
}
BYTE status[2];
halSpiStrobe(CCxxx0_SRX);
Dly1mS(1);
if(halSpiReadStatus(CCxxx0_RXBYTES)==0)
{
return 0;
}
Dly1mS(2);
j=length*90;
while((halSpiReadStatus(CCxxx0_MARCSTATE)&0x1f)!=0x01)
{
Dly1mS(1);
j--;
if(!j)
{
halSpiStrobe(CCxxx0_SIDLE);
halSpiStrobe(CCxxx0_SFRX);
return 0;
}
}
PacketLength = halSpiReadReg(CCxxx0_RXFIFO);
if((PacketLength < RFRXBUFLEN) && (PacketLength > 0))
{
rxBuffer[0] = PacketLength;
halSpiReadBurstReg(CCxxx0_RXFIFO, &rxBuffer[1], PacketLength);
// Read the 2 appended status bytes (status[0] = RSSI, status[1] = LQI)
halSpiReadBurstReg(CCxxx0_RXFIFO, status, 2);
g_RevRSSI = status[0];
return (status[1] & CRC_OK);
}
else if(PacketLength >= RFRXBUFLEN)
{
halSpiStrobe(CCxxx0_SIDLE);
halSpiStrobe(CCxxx0_SFRX);
return 0;
}