defined LIS2DW_FIFO_TIMEOUT_SECOND
This commit is contained in:
committed by
Alessandro Genova
parent
625e920970
commit
757f1a1de7
@@ -448,13 +448,13 @@ static void start_reading(accelerometer_data_acquisition_state_t *state) {
|
||||
|
||||
state->records[state->pos++] = record;
|
||||
lis2dw_fifo_t fifo;
|
||||
lis2dw_read_fifo(&fifo, 100); // dump the fifo, this starts a fresh round of data in continue_reading
|
||||
lis2dw_read_fifo(&fifo, LIS2DW_FIFO_TIMEOUT_SECOND); // dump the fifo, this starts a fresh round of data in continue_reading
|
||||
}
|
||||
|
||||
static void continue_reading(accelerometer_data_acquisition_state_t *state) {
|
||||
printf("Continue reading\n");
|
||||
lis2dw_fifo_t fifo;
|
||||
lis2dw_read_fifo(&fifo, 100);
|
||||
lis2dw_read_fifo(&fifo, LIS2DW_FIFO_TIMEOUT_SECOND);
|
||||
|
||||
fifo.count = min(fifo.count, 25); // hacky, but we need a consistent data rate; if we got a 26th data point, chuck it.
|
||||
uint8_t offset = 4 * (25 - fifo.count); // also hacky: we're sometimes short at the start. align to beginning of next second.
|
||||
|
||||
@@ -420,7 +420,7 @@ static void _monitor_update(lis2dw_monitor_state_t *state)
|
||||
lis2dw_fifo_t fifo;
|
||||
float x = 0, y = 0, z = 0;
|
||||
|
||||
lis2dw_read_fifo(&fifo, 100 / DISPLAY_FREQUENCY);
|
||||
lis2dw_read_fifo(&fifo, LIS2DW_FIFO_TIMEOUT_SECOND / DISPLAY_FREQUENCY);
|
||||
if (fifo.count == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -301,6 +301,8 @@ typedef enum {
|
||||
#define LIS2DW_CTRL7_VAL_HP_REF_MODE 0b00000010
|
||||
#define LIS2DW_CTRL7_VAL_LPASS_ON6D 0b00000001
|
||||
|
||||
#define LIS2DW_FIFO_TIMEOUT_SECOND 100
|
||||
|
||||
bool lis2dw_begin(void);
|
||||
|
||||
uint8_t lis2dw_get_device_id(void);
|
||||
|
||||
Reference in New Issue
Block a user