Rev Author Line No. Line
2116 paro 1 #include "spi.h"
2  
3 #include <avr/io.h>
4  
5 void SPI_MasterInit(void)
6 {
7 /* Enable SPI, Master, set clock rate fck/16, SCK high when idle, sample on rising */
8 // SPSR|= 0b00000001;
9 SPCR = 0b01011101;
10 }
11  
12 unsigned char SPI_MasterTransmit(unsigned char cData) {
13 /* Start transmission */
14 SPDR = cData;
15  
16 /* Wait for transmission complete */
17 while(!(SPSR & (1<<SPIF)))
18 ;
19 return SPDR;
20 }