#defineLM75A_ADDRESS_READ0b10010001#defineLM75A_ADDRESS_WRITE0b10010000#defineLM75A_REGISTER_TEMPERATURE0/* starts i2c */voidinitLM75A();/* gets the full temperature register info and returns it to master */uint16_tgetTemperature();
/*
allows the lm75a temperature register to be read
Returns: unsigned 16bit int containing the temperature. The top 8 bits represent the whole number part of the temperature, bits 9, 10 and 11 represent the fractional part of the temperature (0.5, 0.25 and 0.125 degrees) and the remaining bits are always 0
*/uint16_tgetTemperature(){
i2cStart();i2cSend(LM75A_ADDRESS_WRITE);i2cSend(LM75A_REGISTER_TEMPERATURE);// set register pointer to temperature registeri2cStart();// restart, now readingi2cSend(LM75A_ADDRESS_READ);uint8_t upperByte =i2cRead(ACK);uint8_t lowerByte =i2cRead(NACK);i2cStop();return(upperByte <<8)| lowerByte;}