/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + + FUNCTION NAME: U8 bSpiRegRead(U8 address) + + DESCRIPTION: Read a register of the radio + + INPUT: address - register address + + RETURN: value of the register + + NOTES: it controls the nSEL pin of the radio + +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/ U8 bSpiRegRead(U8 address) { U8 temp8; DisableGlobalIt(); RF_NSEL_PIN = 0; bSpiReadWrite( address ); temp8 = bSpiReadWrite( 0x00 ); RF_NSEL_PIN = 1; EnableGlobalIt(); return temp8; }
/*! * This function is used to read data from SPI port.(target: EzRadioPRO). * * \param[in] biDataOutLength The length of the data. * \param[out] *paboDataOut Pointer to the first element of the response. * * \return None */ void vSpiReadDataBurst(uint8_t biDataOutLength, uint8_t *paboDataOut) { // send command and get response from the radio IC while (biDataOutLength--) { *paboDataOut++ = bSpiReadWrite(0xFF); } }
/*! * This function is used to send data over SPI port (target: EzRadioPRO).no response expected. * * @param[in] biDataInLength The length of the data. * @param[in] *pabiDataIn Pointer to the first element of the data. * * @return None */ void vSpiWriteDataBurst(uint8_t biDataInLength, uint8_t *pabiDataIn) { while (biDataInLength--) { bSpiReadWrite(*pabiDataIn++); } }