inspektors/robot/include/temperature.h
2018-01-23 23:09:21 +02:00

43 lines
874 B
C

/*
ds18b20 lib 0x02
copyright (c) Davide Gironi, 2012
Released under GPLv3.
Please refer to LICENSE file for licensing information.
References:
+ Using DS18B20 digital temperature sensor on AVR microcontrollers
by Gerard Marull Paretas, 2007
http://teslabs.com/openplayer/docs/docs/other/ds18b20_pre1.pdf
*/
#ifndef DS18B20_H_
#define DS18B20_H_
#include <avr/io.h>
#define DS18B20_PORT PORTC
#define DS18B20_DDR DDRC
#define DS18B20_PIN PINC
#define DS18B20_BIT PC0
#define DS18B20_CMD_CONVERTTEMP 0x44
#define DS18B20_CMD_RSCRATCHPAD 0xbe
#define DS18B20_CMD_SKIPROM 0xcc
//stop any interrupt on read
#define DS18B20_STOPINTERRUPTONREAD 1
uint8_t ds18b20_reset(void);
void ds18b20_writebit(uint8_t bit);
uint8_t ds18b20_readbit(void);
void ds18b20_writebyte(uint8_t byte);
uint8_t ds18b20_readbyte(void);
extern double ds18b20_gettemp(void);
#endif