
#define LM73_ADDR1				0x4A //LM81: 0x2c //e6xxx: 0x4c //max1617: 0x18
#define LM73_ADDR_START			0x4A //LM81: 0x2c //e6xxx: 0x4c

//Register Addresses
//signed
#define LM73_TEMP_REG					0x00 //WORD
#define LM73_CONFIG_REG					0x01 //BYTE
#define LM73_UPPER_TEMP_LIMIT_REG		0x02 //WORD
#define LM73_LOWER_TEMP_LIMIT_REG		0x03 //WORD
#define LM73_CTRL_STS_REG				0x04 //BYTE
#define LM73_IDENT_REG					0x07 //WORD


//temperature resolution masks
#define LM73_CTRL_TEMP_RESOL_MASK		0x60
#define LM73_CTRL_TEMP_RESOL_12BIT		0x20		
#define LM73_CTRL_TEMP_RESOL_13BIT		0x40		
#define LM73_CTRL_TEMP_RESOL_14BIT		0x60 		

#define LM73_STS_TEMP_ALERT_PIN			0x08
#define LM73_STS_TEMP_HIGH_FLAG			0x04
#define LM73_STS_TEMP_LOW_FLAG			0x02

// action select defines
#define SEL_UPPER_TEMP_LIMIT			1		
#define SEL_LOWER_TEMP_LIMIT			2

#define SEL_RESOL_11BIT					1
#define SEL_RESOL_12BIT					2
#define SEL_RESOL_13BIT					3
#define SEL_RESOL_14BIT					4

#define SEL_ALERT_ENBL					1
#define SEL_ALERT_DISBL					2

// definitions for temperature handling 
#define LM73_TEMP_MAX		150
#define LM73_TEMP_MIN		(-40)

//determines first bit to read for temperature convertion
// depending on temperature resolution setting in LM73_CTRL_STS_REG
#define RESOL_11BIT		0x20
#define RESOL_12BIT		0x10
#define RESOL_13BIT		0x08
#define RESOL_14BIT		0x04


#define LM73_ALERT_ENBL_MASK		0x20
#define LM73_ALERT_RESET			0x08

//return values
#define ALERT			0xAA
#define HTEMP			0xAB
#define LTEMP			0xAC
#define NTEMP			0xAD


// helper masks
#define WORDMASK		0x8000
#define UCHARMASK		0x80
#define LASTLSB			0x40
