37 #ifndef TEMP_SENSOR_H_
38 #define TEMP_SENSOR_H_
40 #include "lib/sensors.h"
41 #include <sys/clock.h>
45 #define DS18B20_1_PIN OW_BUS_0
46 #define DS18B20_1_IN PIND
47 #define DS18B20_1_OUT PORTD
48 #define DS18B20_1_DDR DDRD
50 #define OW_SET_PIN_LOW() (DS18B20_1_OUT &= ~(1 << DS18B20_1_PIN))
51 #define OW_SET_PIN_HIGH() (DS18B20_1_OUT |= (1 << DS18B20_1_PIN))
52 #define OW_SET_OUTPUT() (DS18B20_1_DDR |= (1 << DS18B20_1_PIN))
53 #define OW_SET_INPUT() (DS18B20_1_DDR &= ~(1 << DS18B20_1_PIN))
54 #define OW_GET_PIN_STATE() ((DS18B20_1_IN & (1 << DS18B20_1_PIN)) ? 1 : 0)
56 #define DS18B20_COMMAND_READ_SCRATCH_PAD 0xBE
57 #define DS18B20_COMMAND_START_CONVERSION 0x44
58 #define DS18B20_COMMAND_SKIP_ROM 0xCC
63 extern uint8_t ds18b20_probe(
void);
64 extern uint8_t ds18b20_get_temp(
double *temp);
65 extern uint8_t crc8_ds18b20(uint8_t *buf, uint8_t buf_len);
67 extern const struct sensors_sensor temp_sensor;
69 #define TEMP_SENSOR "temp"