summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoey Castillo <joeycastillo@utexas.edu>2021-11-30 20:20:21 -0500
committerJoey Castillo <joeycastillo@utexas.edu>2021-11-30 20:20:21 -0500
commitc3095f7cfe448b43ad2d5ffbe2980afa5456309a (patch)
tree99385aa09fb23f4895fed933015c01a92dd5b34e
parent45282f2ef40a54e337b1596af45009c609981130 (diff)
downloadSensor-Watch-c3095f7cfe448b43ad2d5ffbe2980afa5456309a.tar.gz
Sensor-Watch-c3095f7cfe448b43ad2d5ffbe2980afa5456309a.tar.bz2
Sensor-Watch-c3095f7cfe448b43ad2d5ffbe2980afa5456309a.zip
lis2dh: accelerometer testing face
-rw-r--r--apps/Sensor Watch Accelerometer Test/app.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/apps/Sensor Watch Accelerometer Test/app.c b/apps/Sensor Watch Accelerometer Test/app.c
index 6a4c9e3a..f9483ebc 100644
--- a/apps/Sensor Watch Accelerometer Test/app.c
+++ b/apps/Sensor Watch Accelerometer Test/app.c
@@ -20,8 +20,10 @@ void cb_mode_pressed() {
void cb_alarm_pressed() {
}
-uint16_t interrupts = 0;
-uint16_t ticks = 0;
+uint8_t interrupts = 0;
+uint8_t last_interrupts = 0;
+uint8_t ticks = 0;
+char buf[13] = {0};
void cb_interrupt_1() {
interrupts++;
@@ -29,9 +31,9 @@ void cb_interrupt_1() {
void cb_tick() {
if (++ticks == 30) {
+ last_interrupts = interrupts;
interrupts = 0;
ticks = 0;
- watch_display_string("IN t 0", 0);
}
}
@@ -41,7 +43,7 @@ void app_init() {
gpio_set_pin_level(A0, true);
watch_enable_display();
- watch_display_string("IN 0 0", 0);
+ watch_display_string("IN 0 0 0", 0);
watch_enable_external_interrupts();
watch_register_interrupt_callback(BTN_MODE, cb_mode_pressed, INTERRUPT_TRIGGER_RISING);
@@ -75,9 +77,7 @@ void app_wake_from_standby() {
}
bool app_loop() {
- char buf[13] = {0};
-
- sprintf(buf, "IN%2d%4d", ticks, interrupts);
+ sprintf(buf, "IN%2d%3d%3d", ticks, interrupts, last_interrupts);
watch_display_string(buf, 0);
return true;