OneWire + DS18X20 Library
Basic functions for OneWire operations + specific DS18x20 operations
 All Functions Groups Pages
/*****************************************************************************
OneWire (tm) 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 ONEWIRE_H_
#define ONEWIRE_H_
#include <avr/io.h>
#define ONEWIRE_BIT PA0
#define ONEWIRE_PIN PINA
#define ONEWIRE_PORT PORTA
#define ONEWIRE_DDR DDRA
#define ONEWIRE_STRONG_PU_ON ONEWIRE_PORT |= ONEWIRE_MASK; ONEWIRE_DDR |= ONEWIRE_MASK;
#define ONEWIRE_STRONG_PU_OFF ONEWIRE_DDR &= ~ONEWIRE_MASK;
#define ONEWIRE_MASK (1<<ONEWIRE_BIT)
#define ONEWIRE_MATCH_ROM 0x55
#define ONEWIRE_SEARCH_ROM 0xF0
#define ONEWIRE_SKIP_ROM 0xCC
#define ONEWIRE_READ_ROM 0x33
#define ONEWIRE_ALARM_SEARCH 0xEC
uint8_t onewire_reset(void);
uint8_t onewire_read_byte(void);
void onewire_write_byte(uint8_t data);
void onewire_search_init(uint8_t buffer[8]);
uint8_t onewire_alarm_search(uint8_t buffer[8]);
uint8_t onewire_search_rom(uint8_t buffer[8]);
uint8_t onewire_match_rom(const uint8_t rom[8]);
uint8_t onewire_read_rom(uint8_t rom[8]);
uint8_t onewire_skip_rom(void);
uint8_t onewire_crc(const uint8_t *data, uint8_t cnt);
void onewire_write_bit(uint8_t data);
uint8_t onewire_read_bit(void);
uint8_t onewire_search(uint8_t buffer[8], uint8_t cmd);
#endif