15 lines
No EOL
277 B
C
15 lines
No EOL
277 B
C
#include "spi.h"
|
|
#include "ds1722.h"
|
|
|
|
void SPI_init(void){
|
|
DDRB = (1<<PB4)|(1<<PB5)|(1<<PB7);
|
|
SPCR = (1<<SPE)|(1<<MSTR)|(1<<SPR0)|(1<<CPHA);
|
|
PORTB &= ~(1<<PB4);
|
|
}
|
|
|
|
char SPI_transmit_receive(char c){
|
|
SPDR = c;
|
|
do{
|
|
}while(!(SPSR & (1<<SPIF)));
|
|
return SPDR;
|
|
} |