English
Language : 

SDBC-DK3UG Datasheet, PDF (66/76 Pages) Silicon Laboratories – 4 buttons and 4 LEDs for custom purposes
SDBC-DK3 UG
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: RF_ENUM RFPacketReceived (uint8 * packet, uint8 * length)
+ DESCRIPTION:
Check whether the packet received or not.
+ INPUT:
Pointers for storing data and length
+ RETURN:
RF_PACKET_RECEIVED:
Packet received
+
RF_NO_PACKET:
Packet is not yet received
+
RF_CRC_ERROR:
Received a packet with CRC error
+ NOTES:
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
RF_ENUM RFPacketReceived (uint8 * packet, uint8 * length)
{
xdata uint8 i;
// Check if IT occurred or not
if( RF_NIRQ_PIN == 0 )
{
/* check what caused the interrupt */
// read out IT status register
ItStatus1 = SpiRfReadRegister(InterruptStatus1);
ItStatus2 = SpiRfReadRegister(InterruptStatus2);
// packet received interrupt occurred
if( (ItStatus1 & 0x02) == 0x02)
{
// read buffer
*length = SpiRfReadRegister(ReceivedPacketLength) ;
for(i=0;i<*length;i++)
{
*packet++ = SpiRfReadRegister(FIFOAccess);
}
// disable receiver
SpiRfWriteAddressData((REG_WRITE | OperatingFunctionControl1), 0x01);
return RF_PACKET_RECEIVED;
}
// CRC ERROR interrupt occurred
if( (ItStatus1 & 0x01) == 0x01 )
{
// disable receiver
SpiRfWriteAddressData((REG_WRITE | OperatingFunctionControl1), 0x01);
return RF_CRC_ERROR;
}
}
return RF_NO_PACKET;
}
66
Rev. 0.4