//***************************************************************** // // File Name : 'spi.c' // Title : SPI driver // Author : Pascal Stang // Date : 11/22/2000 // Version : 0.1 // Target MCU : ATmega103 // Editor Tabs : 3 // //***************************************************************** #include "io.h" #include #include #include "systimer.h" #include "spi.h" void spiInit() { // setup SPI I/O pins sbi(PORTB, 7); // set SCK hi sbi(DDRB, 7); // set SCK as output sbi(DDRB, 5); // set MOSI as output sbi(DDRB, 4); // SS must be output for Master mode to work // setup SPI interface : // clock = f/4 // select clock phase negative going in middle of data // master mode // enable SPI outp((1<