Exemple #1
0
uint8 NRF24L01_WriteReg(uint8 reg, uint8 data) {
  SPI_SpiUartClearRxBuffer();
  SPI_SpiUartWriteTxData(W_REGISTER | (REGISTER_MASK & reg));
  SPI_SpiUartWriteTxData(data);
  SPI_wait_done();
  SPI_wait_data();
  return SPI_SpiUartReadRxData();
}
    /*******************************************************************************
    * Function Name: SPI_SpiUartPutArray
    ********************************************************************************
    *
    * Summary:
    *  Places an array of data into the transmit buffer to be sent.
    *  This function is blocking and waits until there is a space available to put
    *  all the requested data in the transmit buffer. The array size can be greater
    *  than transmit buffer size.
    *
    * Parameters:
    *  wrBuf:  pointer to an array with data to be placed in transmit buffer.
    *  count:  number of data elements to be placed in the transmit buffer.
    *
    * Return:
    *  None
    *
    *******************************************************************************/
    void SPI_SpiUartPutArray(const uint8 wrBuf[], uint32 count)
    {
        uint32 i;

        for(i=0u; i < count; i++)
        {
            SPI_SpiUartWriteTxData((uint32) wrBuf[i]);
        }
    }
Exemple #3
0
static uint8 Strobe(uint8 state)
{
  SPI_SpiUartClearRxBuffer();
  SPI_SpiUartWriteTxData(state);
  SPI_wait_done();

  SPI_wait_data();
  return SPI_SpiUartReadRxData();
}