nrf24l01/nrf24.c
// Configure a specified RX pipe
// input:
//   pipe - number of the RX pipe, value from 0 to 5
//   aa_state - state of auto acknowledgment, one of nRF24_AA_xx values
//   payload_len - payload length in bytes
Configure a specified RX pipe
input:
pipe - number of the RX pipe, value from 0 to 5
aa_state - state of auto acknowledgment, one of nRF24_AA_xx values
payload_len - payload length in bytes
Configure a specified RX pipe input : pipe - number of the RX pipe value from 0 to 5 aa_state - state of auto acknowledgment one of nRF24_AA_xx values payload_len - payload length in bytes
void nRF24_SetRXPipe(uint8_t pipe, uint8_t aa_state, uint8_t payload_len) {
	uint8_t reg;
	reg = (nRF24_ReadReg(nRF24_REG_EN_RXADDR) | (1 << pipe)) & nRF24_MASK_EN_RX;
	nRF24_WriteReg(nRF24_REG_EN_RXADDR, reg);
	nRF24_WriteReg(nRF24_RX_PW_PIPE[pipe], payload_len & nRF24_MASK_RX_PW);
	reg = nRF24_ReadReg(nRF24_REG_EN_AA);
	if (aa_state == nRF24_AA_ON) {
		reg |=  (1 << pipe);
	} else {
		reg &= ~(1 << pipe);
	}
	nRF24_WriteReg(nRF24_REG_EN_AA, reg);
}
void nRF24_SetRXPipe ( uint8_t pipe , uint8_t aa_state , uint8_t payload_len ) { uint8_t reg ; reg = ( nRF24_ReadReg ( nRF24_REG_EN_RXADDR ) | ( 1 << pipe ) ) & nRF24_MASK_EN_RX ; nRF24_WriteReg ( nRF24_REG_EN_RXADDR , reg ) ; nRF24_WriteReg ( nRF24_RX_PW_PIPE [ pipe ] , payload_len & nRF24_MASK_RX_PW ) ; reg = nRF24_ReadReg ( nRF24_REG_EN_AA ) ; if ( aa_state == nRF24_AA_ON ) { reg |= ( 1 << pipe ) ; } else { reg &= ~ ( 1 << pipe ) ; } nRF24_WriteReg ( nRF24_REG_EN_AA , reg ) ; }
Configure a specified RX pipe
input:
pipe - number of the RX pipe, value from 0 to 5
aa_state - state of auto acknowledgment, one of nRF24_AA_xx values
payload_len - payload length in bytes
Configure a specified RX pipe input : pipe - number of the RX pipe value from 0 to 5 aa_state - state of auto acknowledgment one of nRF24_AA_xx values payload_len - payload length in bytes
// Enable the specified pipe (EN_RXADDR register) // Set RX payload length (RX_PW_Px register) // Set auto acknowledgment for a specified pipe (EN_AA register)