/Designs/Tools/Oscilloscope/SW/firmware/libs/spi.c
0,0 → 1,20
#include "spi.h"
 
#include <avr/io.h>
 
void SPI_MasterInit(void)
{
/* Enable SPI, Master, set clock rate fck/4, SCK high when idle, sample on rising */
// SPSR|= 0b00000001; //for fck/2
SPCR = 0b01011100;
}
 
char SPI_MasterTransmit(char cData) {
/* Start transmission */
SPDR = cData;
 
/* Wait for transmission complete */
while(!(SPSR & (1<<SPIF)))
;
return SPDR;
}