peripherals/c/wireless.c
//*****************************************************************************
// Configures the Nordic nRF24L01+ to be in a point-to-point configuration.
// 
// my_id is a pointer to a 5-byte array that contains the id of the local
// nordic radio
//
// dest_id is a pointer to the 5-byte array that contains the id of the remote
// nordic radio.
//*****************************************************************************
Configures the Nordic nRF24L01+ to be in a point-to-point configuration.
my_id is a pointer to a 5-byte array that contains the id of the local
nordic radio

dest_id is a pointer to the 5-byte array that contains the id of the remote
nordic radio.
Configures the Nordic nRF24L01 + to be in a point - to - point configuration . my_id is a pointer to a 5 - byte array that contains the id of the local nordic radio dest_id is a pointer to the 5 - byte array that contains the id of the remote nordic radio .
bool wireless_configure_device( 
  uint8_t           *my_id,
  uint8_t           *dest_id
)
{
  if( spiVerifyBaseAddr(RF_SPI_BASE))
  {
    wireless_CSN_high();
    wireless_CE_low();
    wireless_flush_tx_fifo();
    wireless_flush_rx_fifo();
    wireless_reg_write(NRF24L01_RF_SETUP_R, NRF24L01_RF_SETUP_RF_PWR_0DB | NRF24L01_RF_SETUP_250_KBPS);
    wireless_reg_write(NRF24L01_RF_CH_R, RF_CHANNEL);
    wireless_reg_write( NRF24L01_STATUS_R, NRF24L01_STATUS_CLEAR_ALL);
    wireless_reg_write(NRF24L01_SETUP_RETR_R, NRF24L01_SETUP_RETR_ARD_0750_US | NRF24L01_SETUP_RETR_ARC_15);
    wireless_set_tx_addr(dest_id);
    wireless_reg_write(NRF24L01_RX_PW_P0_R, RF_PAYLOAD_SIZE);
    wireless_set_rx_addr(dest_id, 0);
    wireless_reg_write(NRF24L01_RX_PW_P1_R, RF_PAYLOAD_SIZE);
    wireless_set_rx_addr(my_id, 1);
    wireless_reg_write(NRF24L01_EN_RXADDR_R, NRF24L01_RXADDR_ERX_P0 | NRF24L01_RXADDR_ERX_P1); 
    wireless_reg_write(NRF24L01_EN_AA_R, NRF24L01_ENAA_P0 | NRF24L01_ENAA_P1);
    wireless_reg_write(NRF24L01_CONFIG_R,NRF24L01_CONFIG_PWR_UP | NRF24L01_CONFIG_EN_CRC | NRF24L01_CONFIG_PRIM_RX_PRX );
    wireless_flush_tx_fifo();
    wireless_flush_rx_fifo();    
    wireless_CE_high();
    return true;
  }
  else
  {
    return false ;
  }
}
bool wireless_configure_device ( uint8_t * my_id , uint8_t * dest_id ) { if ( spiVerifyBaseAddr ( RF_SPI_BASE ) ) { wireless_CSN_high ( ) ; wireless_CE_low ( ) ; wireless_flush_tx_fifo ( ) ; wireless_flush_rx_fifo ( ) ; wireless_reg_write ( NRF24L01_RF_SETUP_R , NRF24L01_RF_SETUP_RF_PWR_0DB | NRF24L01_RF_SETUP_250_KBPS ) ; wireless_reg_write ( NRF24L01_RF_CH_R , RF_CHANNEL ) ; wireless_reg_write ( NRF24L01_STATUS_R , NRF24L01_STATUS_CLEAR_ALL ) ; wireless_reg_write ( NRF24L01_SETUP_RETR_R , NRF24L01_SETUP_RETR_ARD_0750_US | NRF24L01_SETUP_RETR_ARC_15 ) ; wireless_set_tx_addr ( dest_id ) ; wireless_reg_write ( NRF24L01_RX_PW_P0_R , RF_PAYLOAD_SIZE ) ; wireless_set_rx_addr ( dest_id , 0 ) ; wireless_reg_write ( NRF24L01_RX_PW_P1_R , RF_PAYLOAD_SIZE ) ; wireless_set_rx_addr ( my_id , 1 ) ; wireless_reg_write ( NRF24L01_EN_RXADDR_R , NRF24L01_RXADDR_ERX_P0 | NRF24L01_RXADDR_ERX_P1 ) ; wireless_reg_write ( NRF24L01_EN_AA_R , NRF24L01_ENAA_P0 | NRF24L01_ENAA_P1 ) ; wireless_reg_write ( NRF24L01_CONFIG_R , NRF24L01_CONFIG_PWR_UP | NRF24L01_CONFIG_EN_CRC | NRF24L01_CONFIG_PRIM_RX_PRX ) ; wireless_flush_tx_fifo ( ) ; wireless_flush_rx_fifo ( ) ; wireless_CE_high ( ) ; return true ; } else { return false ; } }
Configures the Nordic nRF24L01+ to be in a point-to-point configuration.
Configures the Nordic nRF24L01 + to be in a point - to - point configuration .
// Configure Common RF settings // Configure the address to transfer data to // Configure Pipe 0 to receive the AUTO ACKs from the other device // Configure Pipe 1 // Turn on Rx and AutoAcks for pipe 0 and 1 // Enable the Radio in RX mode // Flush any outstanding info in the TX FIFO