#ifndef DS2482_INC
#define DS2482_INC

#include	<msc_config.h>

// DS2482 ADDRESS BYTES
#define DS2482_ADDR_WR          0x30
#define DS2482_ADDR_RD          0x31

// DS2482 POINTER CODES
#define DS2482_PTR_STATUS       0xF0
#define DS2482_PTR_DATA         0xE1
#define DS2482_PTR_CONFIG       0xC3

// DS2482 COMMAND CODES
#define DS2482_CMD_DRST         0xF0
#define DS2482_CMD_SRP          0xE1
#define DS2482_CMD_WCFG         0xD2
#define DS2482_CMD_1WRS         0xB4
#define DS2482_CMD_1WSB         0x87
#define DS2482_CMD_1WWB         0xA5
#define DS2482_CMD_1WRB         0x96
#define DS2482_CMD_1WT          0x78

// DS2482 BIT MASKS
#define STATUS_1WB              0x01
#define STATUS_PPD              0x02
#define STATUS_SD               0x04
#define STATUS_LL               0x08
#define STATUS_RST              0x10
#define STATUS_SBR              0x20
#define STATUS_TSB              0x40
#define STATUS_DIR              0x80

// DS2482 MISC VALUES
#define POLL_LIMIT              0x20


// DS2482 function prototypes
int   DS2482_detect(void);
int   DS2482_reset(void);
int   DS2482_write_config(uchar config);
int   DS2482_OWReset(int *short_detected);
uchar DS2482_OWReadByte(void);
uchar DS2482_OWWriteByte(uchar sendbyte);


#endif