OneWire + DS18X20 Library
Basic functions for OneWire operations + specific DS18x20 operations
 All Functions Groups Pages
/*****************************************************************************
DS18x20 library
Copyright (C) 2016 Falk Brunner
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
You can contact the author at Falk.Brunner@gmx.de
*****************************************************************************/
#ifndef DS18x20_H_
#define DS18x20_H_
#include <stdint.h>
#define DS1820_CMD_SKIP_ROM 0xCC
#define DS1820_CMD_CONVERT_T 0x44
#define DS1820_CMD_READ_SCRATCHPAD 0xBE
#define DS1820_CMD_WRITE_SCRATCHPAD 0x4E
#define DS1820_CMD_COPY_SCRATCHPAD 0x48
#define DS1820_CMD_RECALL_E2 0xB8
#define DS1820_CMD_READ_POWER_SUPPLY 0xB4
#define DS18B20_ID 0x28
#define DS18S20_ID 0x10
uint8_t ds18x20_convert_t(uint8_t parasitic_power);
#define ds18B20_convert_t(x) ds18x20_convert_t(x)
#define ds18S20_convert_t(x) ds18x20_convert_t(x)
int16_t ds18x20_read_temp(void);
int16_t ds18B20_read_temp(void);
int16_t ds18S20_read_temp(void);
void ds18x20_read_scratchpad(uint8_t *buffer);
#define ds18B20_read_scratchpad(x) ds18x20_read_scratchpad(x)
#define ds18S20_read_scratchpad(x) ds18x20_read_scratchpad(x)
void ds18S20_write_scratchpad(int8_t th, int8_t tl);
void ds18B20_write_scratchpad(uint8_t th, uint8_t tl, uint8_t config);
void ds18x20_copy_scratchpad(uint8_t parasitic_power);
#define ds18B20_copy_scratchpad(x) ds18x20_copy_scratchpad(x);
#define ds18S20_copy_scratchpad(x) ds18x20_copy_scratchpad(x);
void ds18x20_recall_E2(void);
#define ds18B20_recall_E2(x) ds18x20_recall_E2(x)
#define ds18S20_recall_E2(x) ds18x20_recall_E2(x)
#define ds18B20_read_power_supply(x) ds18x20_read_power_supply(x)
#define ds18S20_read_power_supply(x) ds18x20_read_power_supply(x)
#endif