#define DEBUG_LOW 1
#define DEBUG_HIGH 2
#if 1
-#define PRINTD(l, ...) do { if (DEBUG & (l)) { printf ("\r%5u %s: ", ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } } while(0)
+#define PRINTD(l, ...) do { if (DEBUG & (l)) { printf ("\r%5lu %s: ", (unsigned long) ao_tick_count, __func__); printf(__VA_ARGS__); flush(); } } while(0)
#else
#define PRINTD(l,...)
#endif
+#define AO_MMA655X_SPI_SPEED ao_spi_speed(8333333) /* 120ns clock period */
+
static void
ao_mma655x_start(void) {
ao_spi_get_bit(AO_MMA655X_CS_PORT,
AO_MMA655X_CS_PIN,
AO_MMA655X_SPI_INDEX,
- AO_SPI_SPEED_FAST);
+ AO_MMA655X_SPI_SPEED);
}
static void
ao_delay(AO_ST_DELAY);
}
if (tries == AO_ST_TRIES)
- ao_sensor_errors = 1;
+ AO_SENSOR_ERROR(AO_DATA_MMA655X);
ao_mma655x_reg_write(AO_MMA655X_DEVCFG,
DEVCFG_VALUE | (1 << AO_MMA655X_DEVCFG_ENDINIT));