lis2dw: dump all fifo data in loop

This commit is contained in:
Joey Castillo 2022-02-18 09:53:22 -05:00
parent 75c98a6c97
commit 2670f611cc

View file

@ -16,22 +16,13 @@ static void cb_alarm_pressed(void) {
uint8_t interrupts = 0; uint8_t interrupts = 0;
uint8_t last_interrupts = 0; uint8_t last_interrupts = 0;
uint8_t ticks = 0; bool tick = false;
char buf[13] = {0}; char buf[13] = {0};
static void cb_tick(void) { static void cb_tick(void) {
watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
if (!lis2dw_have_new_data()) return; if (!lis2dw_have_new_data()) return;
watch_set_indicator(WATCH_INDICATOR_SIGNAL); tick = true;
lis2dw_fifo_t fifo;
bool overrun = lis2dw_read_fifo(&fifo);
printf("FIFO captured %d readings.\n", fifo.count);
if (overrun) printf("\tThere was an overrun!\n\n");
printf("%d, %d, %d\n", fifo.readings[0].x, fifo.readings[0].y, fifo.readings[0].z);
printf("%d, %d, %d\n", fifo.readings[10].x, fifo.readings[10].y, fifo.readings[10].z);
printf("%d, %d, %d\n", fifo.readings[20].x, fifo.readings[20].y, fifo.readings[20].z);
} }
void app_init(void) { void app_init(void) {
@ -68,8 +59,14 @@ void app_wake_from_standby(void) {
} }
bool app_loop(void) { bool app_loop(void) {
// TODO: interrupt configuration for LIS2DW if (tick) {
watch_display_string(buf, 0); tick = false;
lis2dw_fifo_t fifo;
lis2dw_read_fifo(&fifo);
for(int i = 0; i < fifo.count; i++) {
printf("%d, %d, %d, %d, %d\n", fifo.readings[i].x, fifo.readings[i].y, fifo.readings[i].z, i, fifo.count);
}
}
return true; return true;
} }