Routines to access TMP75 temperature sensor. More...
Functions | |
void | tmp75_convert_temp (uns8 addr) |
Start temperature conversion on tmp75. | |
uns8 | tmp75_get_config (uns8 addr) |
Get tmp75 config register. | |
uns16 | tmp75_get_temp (uns8 addr) |
Read temperature from tmp75. | |
uns8 | tmp75_read (uns8 addr, uns8 pointer) |
uns16 | tmp75_read_16bit (uns8 addr, uns8 pointer) |
void | tmp75_set_config (uns8 addr, uns8 config) |
Set tmp75 config register. | |
void | tmp75_setup () |
uns8 | tmp75_write (uns8 addr, uns8 pointer, uns8 data) |
void tmp75_convert_temp | ( | uns8 | addr | ) |
uns8 tmp75_get_config | ( | uns8 | addr | ) |
Gets the tmp75 config register (memory location 0x01)
00103 { 00104 return tmp75_read(addr, TMP75_CONFIG_REGISTER); 00105 }
uns16 tmp75_get_temp | ( | uns8 | addr | ) |
Returns 16bit raw temperature register from tmp75.
00116 { 00117 return tmp75_read_16bit(addr, TMP75_TEMP_REGISTER); 00118 00119 }
uns8 tmp75_read | ( | uns8 | addr, | |
uns8 | pointer | |||
) |
00042 { 00043 uns8 data; 00044 00045 i2c_start(); 00046 i2c_send_byte(0x90 + addr); // w=0, write pointer 00047 00048 i2c_send_byte(pointer); // includes reading ack 00049 00050 i2c_start(); 00051 i2c_send_byte(0x90 + addr + 1); // read 00052 00053 data = i2c_receive_byte(); 00054 00055 00056 i2c_stop(); 00057 00058 return data; 00059 }
uns16 tmp75_read_16bit | ( | uns8 | addr, | |
uns8 | pointer | |||
) |
00073 { 00074 uns16 data; 00075 00076 i2c_start(); 00077 i2c_send_byte(0x90 + addr); // LSB=0 == write 00078 i2c_send_byte(pointer); 00079 00080 i2c_start(); 00081 i2c_send_byte(0x90 + addr + 1); // LSB=0 == read 00082 data = i2c_receive_byte(); 00083 00084 i2c_send_ack(); 00085 00086 data = data << 8 | i2c_receive_byte(); // reuse local variable 00087 00088 i2c_send_ack(); 00089 00090 i2c_stop(); 00091 }
void tmp75_set_config | ( | uns8 | addr, | |
uns8 | config | |||
) |
Sets the tmp75 config register
00098 { 00099 tmp75_write(addr, TMP75_CONFIG_REGISTER, config); 00100 }
void tmp75_setup | ( | ) |
00093 { 00094 i2c_setup(); 00095 }
uns8 tmp75_write | ( | uns8 | addr, | |
uns8 | pointer, | |||
uns8 | data | |||
) |
00061 { 00062 00063 i2c_start(); 00064 i2c_send_byte(0x90 + addr); 00065 i2c_send_byte(pointer); 00066 00067 i2c_send_byte(data); 00068 00069 i2c_stop(); 00070 }