18 lines
No EOL
366 B
C
18 lines
No EOL
366 B
C
#include "spi.h"
|
|
#include "ds1722.h"
|
|
|
|
void DS1722_init(void){
|
|
PORTB |= 1<<PB4;
|
|
SPI_transmit_receive(REG_D51722_CONFIG_BIT);
|
|
SPI_transmit_receive(REG_D51722_CONFIG_WRITE);
|
|
PORTB &= ~(1<<PB4);
|
|
}
|
|
|
|
char DS1722_read(void){
|
|
char y;
|
|
PORTB |= 1<<PB4;
|
|
SPI_transmit_receive(REG_D51722_MSB);
|
|
y=SPI_transmit_receive(0);
|
|
PORTB &= ~(1<<PB4);
|
|
return y;
|
|
} |