#include <string.h>
unsigned int temp_xCel;
void main ()
{
uint8_t pr = 0;
#if BSP430_PLATFORM_PERIPHERAL_HELP
#endif
0, 0);
if (! i2c) {
return;
}
#define TMP102_RAW_TO_dC_(raw_) (5 * ((raw_) >> 3) / 16)
#define TMP102_RAW_TO_dC(raw_) ((0 <= (int)(raw_)) ? TMP102_RAW_TO_dC_(raw_) : -TMP102_RAW_TO_dC_(-(int)(raw_)))
#define dC_TO_dF(dC_) (320 + 9 * (dC_) / 5)
#if 0
{
unsigned int data[] = { 0x7FF0, 0x4B00, 0x1900, 0xFFC0, 0xE700, 0xC908 };
int i;
for (i = 0; i < sizeof(data)/sizeof(*data); ++i) {
int temp_dC = TMP102_RAW_TO_dC(data[i]);
cprintf(
"temp 0x%04x = %d dC = %d d[degF]\n", data[i], temp_dC, dC_TO_dF(temp_dC));
}
}
#endif
while (1) {
int rc;
uint8_t data[2];
uint16_t raw;
if (0 > rc) {
break;
}
memset(data, 0, sizeof(data));
if (0 > rc) {
break;
}
raw = data[1] | (data[0] << 8);
if (0 == pr) {
int temp_dC = TMP102_RAW_TO_dC(raw);
cprintf(
"temp 0x%04x = %d dC = %d d[degF]\n", raw, temp_dC, dC_TO_dF(temp_dC));
} else {
cprintf(
"reg %d is 0x%04x\n", pr, raw);
}
pr = (pr + 1) & 0x03;
}
}