36 {   
if (!bcm2835_init())
 
   38         printf(
"BCM libray error.\n");          
 
   41     bcm2835_spi_setBitOrder(BCM2835_SPI_BIT_ORDER_MSBFIRST);        
 
   42     bcm2835_spi_setDataMode(BCM2835_SPI_MODE0);             
 
   43     bcm2835_spi_setClockDivider(BCM2835_SPI_CLOCK_DIVIDER_8);   
 
   44     bcm2835_spi_chipSelect(BCM2835_SPI_CS_NONE);            
 
   45     printf(
"SPI initialized...\n");
 
   55     return bcm2835_spi_transfer(data);
 
   64     unsigned char data = bcm2835_spi_transfer(0xff);
 
   76     bcm2835_spi_writenb(buff,length);
 
   88     bcm2835_spi_transfernb(sArray,rArray,length);
 
unsigned char SPI_Write(unsigned char data)
Writes a byte of data to the SPI bus. 
 
unsigned char SPI_Read(void)
Reads a byte of data from the SPI bus. 
 
void SPI_Initialize(void)
Initializes the SPI peripheral. 
 
void SPI_Write_Array(char *buff, unsigned int length)
Writes an array of bytes to the SPI bus. 
 
void SPI_Close(void)
Close SPI bus, should not be called if another SPI device is being used. 
 
void SPI_Read_Array(char *sArray, char *rArray, char length)
Reads an array of data from the SPI bus.