#if ! (BSP430_CONSOLE - 0)
#error Console is not configured correctly
#endif
#if ! (BSP430_UPTIME - 0)
#error Uptime is not configured correctly
#endif
#ifndef APP_DS18B20_BUS
#define APP_DS18B20_BUS ds18b20
.
port = APP_DS18B20_PORT_HAL,
.bit = APP_DS18B20_BIT,
};
#endif
#ifndef APP_DS18B20_POWER_BIT
#define APP_DS18B20_POWER_BIT 0
#endif
void main ()
{
int rc;
int external_power;
static const char * const supply_type[] = { "parasitic", "external" };
cprintf(
"Uptime now %lu with frequency %lu Hz\n",
cprintf(
"Monitoring DS18xx on %s.%u ; ",
if (APP_DS18B20_POWER_BIT) {
cprintf(
"parasitic conversion power from %s.%u\n",
} else {
cprintf(
"no parasitic power boost\n");
}
cprintf(
"Power supply: %s\n", supply_type[external_power]);
if (0 > external_power) {
cprintf(
"ERROR: Device not present?\n");
} else if ((! external_power) && (! (APP_DS18B20_POWER_BIT))) {
cprintf(
"ERROR: Parasitic power without conversion boost?\n");
}
do {
if (0 != rc) {
cprintf(
"ERROR: Failed to read serial number from DS18B20: %d\n", rc);
}
} while (0 != rc);
cprintf(
"DS18B20 serial number: %02x%02x%02x%02x%02x%02x\n",
serial.id[0], serial.id[1], serial.id[2],
serial.id[3], serial.id[4], serial.id[5]);
while (1) {
int rc;
unsigned long start_tck;
unsigned long end_tck;
unsigned int duration_ms;
int t_c;
rc = -1;
if (external_power) {
}
} else {
}
}
if (0 == rc) {
cprintf(
"Temperature %d dCel or %d d[degF] in %u ms\n",
duration_ms);
} else {
cprintf(
"Measurement failed in %u ms\n", duration_ms);
}
}
}