English
Language : 

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