peripherals/c/wireless.c
//*****************************************************************************
// Transmits 4 bytes of data to the remote device.
//
// A return code of NRF24L01_TX_SUCCESS is used to indicate that the data
// was transmitted sucessfully
//*****************************************************************************
Transmits 4 bytes of data to the remote device.
A return code of NRF24L01_TX_SUCCESS is used to indicate that the data
was transmitted sucessfully
Transmits 4 bytes of data to the remote device . A return code of NRF24L01_TX_SUCCESS is used to indicate that the data was transmitted sucessfully
wireless_com_status_t 
wireless_send_32(
  bool      blockOnFull,
  bool      retry,
  uint32_t  data
)
{ 
  uint8_t status;
  if( spiVerifyBaseAddr(RF_SPI_BASE))
  {
    status = wireless_get_status();
    if( wireless_status_tx_full_asserted(status) && (blockOnFull == false))
    {
       return NRF24L01_TX_FIFO_FULL;
    }
    while(wireless_status_tx_full_asserted(status))
    {
        status = wireless_get_status();
    }
    do
    {
      wireless_CE_low();
      wireless_clear_max_rt();
      wireless_start_tx_mode();
      wireless_flush_tx_fifo();
      wireless_tx_data_payload(data);
      wireless_CE_Pulse();
       status = wireless_wait_for_tx_ds();
       if( status == false)
       {
         wireless_clear_max_rt();
       }
       else
       {
          wireless_clear_tx_ds();
       }
    } while( status == false && retry == true);
      wireless_start_rx_mode();
      wireless_CE_high();
    if (status == true)
    {
      return NRF24L01_TX_SUCCESS;
    }
    else
    {
      return NRF24L01_TX_PCK_LOST;
    }
  }
  else
  {
    return NRF24L01_ERR;
  }
}
wireless_com_status_t wireless_send_32 ( bool blockOnFull , bool retry , uint32_t data ) { uint8_t status ; if ( spiVerifyBaseAddr ( RF_SPI_BASE ) ) { status = wireless_get_status ( ) ; if ( wireless_status_tx_full_asserted ( status ) && ( blockOnFull == false ) ) { return NRF24L01_TX_FIFO_FULL ; } while ( wireless_status_tx_full_asserted ( status ) ) { status = wireless_get_status ( ) ; } do { wireless_CE_low ( ) ; wireless_clear_max_rt ( ) ; wireless_start_tx_mode ( ) ; wireless_flush_tx_fifo ( ) ; wireless_tx_data_payload ( data ) ; wireless_CE_Pulse ( ) ; status = wireless_wait_for_tx_ds ( ) ; if ( status == false ) { wireless_clear_max_rt ( ) ; } else { wireless_clear_tx_ds ( ) ; } } while ( status == false && retry == true ) ; wireless_start_rx_mode ( ) ; wireless_CE_high ( ) ; if ( status == true ) { return NRF24L01_TX_SUCCESS ; } else { return NRF24L01_TX_PCK_LOST ; } } else { return NRF24L01_ERR ; } }
Transmits 4 bytes of data to the remote device.
Transmits 4 bytes of data to the remote device .
// Check the status of the device // Wait while the TX FIFO is not full  // Put into Standby-1 // Set tx_mode // Flush any outstanding info in the TX FIFO // Send the data to the TX_PLD // Pulse CE for a 15uS //printf(" ** ERR ** MAX_RT exceeded\n\r"); // Clear the tx_ds bit // Set PRIM_RX High // Enable Wireless transmission