peripherals/c/wireless.c
//*****************************************************************************
// Receives 4 bytes of data from the remote board.  The user can optionally
// block until data arrives.
//
// The data received is returned in the *data paramter
// 
// Returns NRF24L01_RX_SUCCESS on a successful packet reception
//*****************************************************************************
Receives 4 bytes of data from the remote board.  The user can optionally
block until data arrives.

The data received is returned in the *data paramter

Returns NRF24L01_RX_SUCCESS on a successful packet reception
Receives 4 bytes of data from the remote board . The user can optionally block until data arrives . The data received is returned in the * data paramter Returns NRF24L01_RX_SUCCESS on a successful packet reception
wireless_com_status_t
wireless_get_32(
  bool      blockOnEmpty,
  uint32_t  *data
)
{
  if( spiVerifyBaseAddr(RF_SPI_BASE))
  {
    if( wireless_rx_fifo_empty() == false)
    {
      wireless_rx_data_payload(data);
      if ( wireless_rx_fifo_empty() ==  true)
      {
          wireless_reg_write(NRF24L01_STATUS_R, NRF24L01_STATUS_RX_DR_M);
      }
      return NRF24L01_RX_SUCCESS;
    }
    else if ( (wireless_rx_fifo_empty() == true) && blockOnEmpty)
    {
      wireless_wait_for_rx_dr();
      wireless_rx_data_payload( data);
      if ( wireless_rx_fifo_empty() ==  true)
      {
          wireless_reg_write(NRF24L01_STATUS_R, NRF24L01_STATUS_RX_DR_M);
      }
      return NRF24L01_RX_SUCCESS;
    }
    else
    {
      return NRF24L01_RX_FIFO_EMPTY;
    }
  }
  else
  {
    return NRF24L01_ERR;
  }
}
wireless_com_status_t wireless_get_32 ( bool blockOnEmpty , uint32_t * data ) { if ( spiVerifyBaseAddr ( RF_SPI_BASE ) ) { if ( wireless_rx_fifo_empty ( ) == false ) { wireless_rx_data_payload ( data ) ; if ( wireless_rx_fifo_empty ( ) == true ) { wireless_reg_write ( NRF24L01_STATUS_R , NRF24L01_STATUS_RX_DR_M ) ; } return NRF24L01_RX_SUCCESS ; } else if ( ( wireless_rx_fifo_empty ( ) == true ) && blockOnEmpty ) { wireless_wait_for_rx_dr ( ) ; wireless_rx_data_payload ( data ) ; if ( wireless_rx_fifo_empty ( ) == true ) { wireless_reg_write ( NRF24L01_STATUS_R , NRF24L01_STATUS_RX_DR_M ) ; } return NRF24L01_RX_SUCCESS ; } else { return NRF24L01_RX_FIFO_EMPTY ; } } else { return NRF24L01_ERR ; } }
Receives 4 bytes of data from the remote board.
Receives 4 bytes of data from the remote board .
//uint8_t status; // Read data from Rx FIFO // If Rx FIFO is empty, clear the RX_DR bit in the status // register // Clear the RX_DR bit // Wait until the RX_DR bit is set // Read data from Rx FIFO // If Rx FIFO is empty, clear the RX_DR bit in the status // register // Clear the RX_DR bit