//set the receive function
CC2500_Write_RxADDR();
CC2500_SetRxMode(); //set the mode is receive mode
while(1){
while (SPI_GDO0==0);// Wait for GDO0 to be set -> sync transmitted
while (SPI_GDO0); // Wait for GDO0 to be cleared -> end of packet
UARTprintf("receive ok\n");
if(CC2500_RxPacket()){ //wait for reading the receive data over,if read ok,return 1,else return 0
for(i=0;i<(CC2500_DATA_LEN+1+2);i++){
UARTprintf("%d ",CC2500_TxRxBuf); //display the received data
}
UARTprintf("\n");
CC2500_Write_RxADDR();
CC2500_SetRxMode();
UARTprintf("%x\n",CC2500_ReadReg(CCxxx0_RSSI ));
UARTprintf("%x\n",CC2500_ReadReg(CCxxx0_LQI ));