inspektors/robot/include/temperature.h

43 lines
874 B
C
Raw Normal View History

2017-11-24 13:40:29 +02:00
/*
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>
2017-12-30 22:48:10 +02:00
#define DS18B20_PORT PORTC
#define DS18B20_DDR DDRC
#define DS18B20_PIN PINC
2018-01-02 14:18:30 +02:00
#define DS18B20_BIT PC0
2017-11-24 13:40:29 +02:00
#define DS18B20_CMD_CONVERTTEMP 0x44
#define DS18B20_CMD_RSCRATCHPAD 0xbe
#define DS18B20_CMD_SKIPROM 0xcc
//stop any interrupt on read
#define DS18B20_STOPINTERRUPTONREAD 1
2018-01-02 14:18:30 +02:00
2017-11-24 13:40:29 +02:00
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