I am trying to interface ADXL372 with nrf51822 using SPI interface.
Tried merging this code in SPI master example:
But I am not getting the required data.
Need help to get adxl372 working with SPI.
Below is the function I tried:
int spi_write_then_read(adxl_spi_handle *spiTransfer,
unsigned char *txbuf,
unsigned n_tx,
unsigned char *rxbuf,
unsigned n_rx)
{
unsigned char count;
int err = 0;
uint32_t err_code;
while(spi_master_get_state(SPI_MASTER_0) != SPI_MASTER_STATE_IDLE);
err_code = spi_master_send_recv(SPI_MASTER_0, txbuf, n_tx, rxbuf,n_rx);
APP_ERROR_CHECK(err_code);
return err;
}