Silicon Laboratories C8051F930 User Manual page 71

Wireless software development kit
Hide thumbs Also See for C8051F930:
Table of Contents

Advertisement

/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
FUNCTION NAME:
+
DESCRIPTION:
+
INPUT:
+
RETURN:
+
NOTES:
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void SpiWrite(uint8 spi_in)
{
SPI1DAT = spi_in;
while( SPIF1 == 0);
SPIF1 = 0;
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
FUNCTION NAME:
+
DESCRIPTION:
+
INPUT:
+
RETURN:
+
NOTES:
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
uint8 SpiReadWrite(uint8 spi_in)
{
SPI1DAT = spi_in;
while( SPIF1 == 0);
SPIF1 = 0;
return SPI1DAT;
}
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+
FUNCTION NAME:
+
DESCRIPTION:
+
INPUT:
+
+
RETURN:
+
NOTES:
+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void SpiRfWriteAddressData(uint8 address, uint8 d)
{
RF_NSEL_PIN = 0;
SpiWrite(address);
SpiWrite(d);
RF_NSEL_PIN = 1;
}
void SpiWrite(uint8 spi_in)
Sends 8 bits length data through the SPI port
Data
None
It doesn't control the nSEL pin
uint8 SpiReadWrite(uint8 data)
Sends and read 8 bits length data through the SPI port
Data
Received byte
It doesn't control the nSEL pin
void SpiRfWriteAddressData(uint8 address, uint8 data1)
Sends 16 length data through the SPI port (address and data)
Address - register address
Data - 8bit data
None
It controls the nSEL pin
Rev. 0.3
SDBC-DK3 UG
//write data into the SPI register
//wait for sending the data
//clear interrupt flag
//write data into the SPI register
//wait for sending the data
//clear interrupt flag
//read received bytes
71

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the C8051F930 and is the answer not in the manual?

Table of Contents