#include "spi.h"

#include <avr/io.h>

void SPI_MasterInit(void)
{
  /* Enable SPI, Master, set clock rate fck/16, SCK high when idle, sample on rising */
//  SPSR|= 0b00000001;
  SPCR = 0b01011101;
}

unsigned char SPI_MasterTransmit(unsigned char cData) {
  /* Start transmission */
  SPDR = cData;

  /* Wait for transmission complete */
  while(!(SPSR & (1<<SPIF)))
    ;
  return SPDR;
}