nrf24l01/nrf24.c
// Check if the nRF24L01 present
// return:
//   1 - nRF24L01 is online and responding
//   0 - received sequence differs from original
Check if the nRF24L01 present
return:
1 - nRF24L01 is online and responding
0 - received sequence differs from original
Check if the nRF24L01 present return : 1 - nRF24L01 is online and responding 0 - received sequence differs from original
uint8_t nRF24_Check(void) {
	uint8_t rxbuf[5];
	uint8_t i;
	uint8_t *ptr = (uint8_t *)nRF24_TEST_ADDR;
	nRF24_WriteMBReg(nRF24_CMD_W_REGISTER | nRF24_REG_TX_ADDR, ptr, 5);
	nRF24_ReadMBReg(nRF24_CMD_R_REGISTER | nRF24_REG_TX_ADDR, rxbuf, 5);
	for (i = 0; i < 5; i++) {
		if (rxbuf[i] != *ptr++) return 0;
	}
	return 1;
}
uint8_t nRF24_Check ( void ) { uint8_t rxbuf [ 5 ] ; uint8_t i ; uint8_t * ptr = ( uint8_t * ) nRF24_TEST_ADDR ; nRF24_WriteMBReg ( nRF24_CMD_W_REGISTER | nRF24_REG_TX_ADDR , ptr , 5 ) ; nRF24_ReadMBReg ( nRF24_CMD_R_REGISTER | nRF24_REG_TX_ADDR , rxbuf , 5 ) ; for ( i = 0 ; i < 5 ; i ++ ) { if ( rxbuf [ i ] != * ptr ++ ) return 0 ; } return 1 ; }
Check if the nRF24L01 present
return:
1 - nRF24L01 is online and responding
0 - received sequence differs from original
Check if the nRF24L01 present return : 1 - nRF24L01 is online and responding 0 - received sequence differs from original
// Write test TX address and read TX_ADDR register // Compare buffers, return error on first mismatch