diff options
author | Joey Castillo <joeycastillo@utexas.edu> | 2022-02-18 09:53:22 -0500 |
---|---|---|
committer | Joey Castillo <joeycastillo@utexas.edu> | 2022-02-18 09:53:22 -0500 |
commit | 2670f611cc77b625bc714ab07221236ce718733e (patch) | |
tree | 818afce97ab09d1e9581f69f72ddecc8a2c04cbd /apps | |
parent | 75c98a6c97cf9d680d70e2d608490f2d3c5da228 (diff) | |
download | Sensor-Watch-2670f611cc77b625bc714ab07221236ce718733e.tar.gz Sensor-Watch-2670f611cc77b625bc714ab07221236ce718733e.tar.bz2 Sensor-Watch-2670f611cc77b625bc714ab07221236ce718733e.zip |
lis2dw: dump all fifo data in loop
Diffstat (limited to 'apps')
-rw-r--r-- | apps/accelerometer-test/app.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/apps/accelerometer-test/app.c b/apps/accelerometer-test/app.c index bd4cdaaa..4a64e355 100644 --- a/apps/accelerometer-test/app.c +++ b/apps/accelerometer-test/app.c @@ -16,22 +16,13 @@ static void cb_alarm_pressed(void) { uint8_t interrupts = 0; uint8_t last_interrupts = 0; -uint8_t ticks = 0; +bool tick = false; char buf[13] = {0}; static void cb_tick(void) { - watch_clear_indicator(WATCH_INDICATOR_SIGNAL); if (!lis2dw_have_new_data()) return; - watch_set_indicator(WATCH_INDICATOR_SIGNAL); - 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); + tick = true; } void app_init(void) { @@ -68,8 +59,14 @@ void app_wake_from_standby(void) { } bool app_loop(void) { - // TODO: interrupt configuration for LIS2DW - watch_display_string(buf, 0); + if (tick) { + 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; } |