struct ao_ms5607_prom ao_ms5607_prom;
static uint8_t ms5607_configured;
-#ifndef AO_MS5607_SPI_SPEED
-#define AO_MS5607_SPI_SPEED AO_SPI_SPEED_FAST
-#endif
+#define AO_MS5607_SPI_SPEED ao_spi_speed(20000000)
static void
ao_ms5607_start(void) {
prom[15] = 0;
for (cnt = 0; cnt < 16; cnt++) {
- n_rem ^= *p++;
+ n_rem ^= (uint16_t) *p++;
for (n_bit = 8; n_bit > 0; n_bit--) {
if (n_rem & 0x8000)
- n_rem = (n_rem << 1) ^ 0x3000;
+ n_rem = (uint16_t) ((n_rem << 1) ^ 0x3000U);
else
n_rem = (n_rem << 1);
}
}
n_rem = (n_rem >> 12) & 0xf;
prom[15] = crc_byte;
- return n_rem;
+ return (uint8_t) n_rem;
}
static bool
if (!ao_ms5607_prom_valid((uint8_t *) prom)) {
#if HAS_SENSOR_ERRORS
- ao_sensor_errors = 1;
+ AO_SENSOR_ERROR(AO_DATA_MS5607);
#else
ao_panic(AO_PANIC_SELF_TEST_MS5607);
#endif