return n_rem;
}
-static int
+static bool
ao_ms5607_prom_valid(uint8_t *prom)
{
uint8_t crc;
if (*p++ + 1 > 1)
break;
if (i == 16)
- return FALSE;
+ return false;
crc = ao_ms5607_crc(prom);
if (crc != (prom[15] & 0xf))
- return FALSE;
+ return false;
- return TRUE;
+ return true;
}
static void
r++;
}
- if (!ao_ms5607_prom_valid((uint8_t *) prom))
+
+ if (!ao_ms5607_prom_valid((uint8_t *) prom)) {
+#if HAS_SENSOR_ERRORS
+ AO_SENSOR_ERROR(AO_DATA_MS5607);
+#else
ao_panic(AO_PANIC_SELF_TEST_MS5607);
+#endif
+ }
#if __BYTE_ORDER == __LITTLE_ENDIAN
/* Byte swap */
void
ao_ms5607_info(void)
{
+#if !HAS_MS5607_TASK
+ ao_ms5607_setup();
+#endif
printf ("ms5607 reserved: %u\n", ao_ms5607_prom.reserved);
printf ("ms5607 sens: %u\n", ao_ms5607_prom.sens);
printf ("ms5607 off: %u\n", ao_ms5607_prom.off);
{
struct ao_ms5607_value value;
+#if !HAS_MS5607_TASK
+ ao_ms5607_sample(&ao_ms5607_current);
+#endif
ao_ms5607_convert(&ao_ms5607_current, &value);
printf ("Pressure: %8lu %8ld\n", ao_ms5607_current.pres, value.pres);
printf ("Temperature: %8lu %8ld\n", ao_ms5607_current.temp, value.temp);