#include "typedefine.h"
 
tUInt OW_Reset(void);
unsigned char OW_ReadByte(void);
void OW_WriteByte (unsigned char write_data);
void OW_WriteInt (unsigned int write_data);
void OW_WriteBit (unsigned char write_bit);
void OW_DriveHigh (void);
void OW_DriveLow (void);

int iButtonRead(tUChar *pdata);
tUInt OW_CRC( tUChar *iButtonData, tUChar len);


#define HIGH	1
#define LOW		0


#define OW_NO_RESET			0
#define OW_RESET_OK			1
#define OW_SHORT			2
#define OW_OPEN				3

#define OW_PIN_DIRECTION_OUTPUT	{ prc2 = 1;  OW_DIR_PIN = 1;  prc2 = 0; }
#define OW_PIN_DIRECTION_INPUT	{ prc2 = 1;  OW_DIR_PIN = 0;  prc2 = 0; }
 
 
// prikazy ONEWIRE pro DS1388 a DS18B20 
#define ONEWIRE_CMD_READ_ROM			0x33
#define ONEWIRE_CMD_SKIP_ROM 			0xCC
#define ONEWIRE_CMD_CONVERT_T			0x44 
#define ONEWIRE_CMD_READ_SCRATCHPAD		0xBE
#define ONEWIRE_CMD_WRITE_SCRATCHPAD	0x4E 
#define ONEWIRE_CMD_COPY_SCRATCHPAD		0x48
#define ONEWIRE_CMD_RECALL_E2			0xB8
#define ONEWIRE_CMD_READ_POWER_SUPPLY	0xB4

// definice rozliseni
#define DS18B20_RESOLUTION_9BIT			(0x00<<5)
#define DS18B20_RESOLUTION_10BIT		(0x01<<5)
#define DS18B20_RESOLUTION_11BIT		(0x02<<5)
#define DS18B20_RESOLUTION_12BIT		(0x03<<5)