//Gets the received power detectorboolread_RPD_nRF24L01(void){uint8_ti,j,data,cmd;cmd=0x09;//Read RPD register ==========================================================================================cbi(L01_PORT,L01_CSN);//CSN = 0delay_us(RF_DELAY);for(i=0;i<8;i++){if(cmd&0b10000000)sbi(L01_PORT,MOSI);elsecbi(L01_PORT,MOSI);sbi(L01_PORT,L01_SCK);//L01_SCK = 1;delay_us(RF_DELAY);cbi(L01_PORT,L01_SCK);//L01_SCK = 0; delay_us(RF_DELAY);cmd<<=1;}//read the 1 byte register and the LSB is the last bit with the RPD flagfor(i=0;i<8;i++){if(i==7&&(L01_PORT_PIN&(1<<MISO)))returntrue;//we are receiving more than -64dBmelseif(i==7&&(L01_PORT_PIN&(0<<MISO)))returnfalse;//we are receiving less than -64dBm//read the next bitsbi(L01_PORT,L01_SCK);//L01_SCK = 1;delay_us(RF_DELAY);cbi(L01_PORT,L01_SCK);//L01_SCK = 0; delay_us(RF_DELAY);}sbi(L01_PORT,L01_CSN);//CSN = 1}