diff --git a/Makefile b/Makefile index 784d51ba..ec57af06 100644 --- a/Makefile +++ b/Makefile @@ -51,6 +51,7 @@ SRCS += \ ./shell/shell.c \ ./shell/shell_cmd_list.c \ ./movement/lib/sunriset/sunriset.c \ + ./watch-library/shared/driver/lis2dw.c \ ./watch-library/shared/driver/thermistor_driver.c \ ./watch-library/shared/watch/watch_common_buzzer.c \ ./watch-library/shared/watch/watch_common_display.c \ diff --git a/movement_faces.h b/movement_faces.h index 1f7df834..68da1981 100644 --- a/movement_faces.h +++ b/movement_faces.h @@ -32,6 +32,7 @@ #include "fast_stopwatch_face.h" #include "sunrise_sunset_face.h" #include "character_set_face.h" +#include "accel_interrupt_count_face.h" #include "all_segments_face.h" #include "float_demo_face.h" #include "temperature_display_face.h" diff --git a/watch-faces.mk b/watch-faces.mk index 68798ad0..98c7ef8c 100644 --- a/watch-faces.mk +++ b/watch-faces.mk @@ -6,6 +6,7 @@ SRCS += \ ./watch-faces/complication/countdown_face.c \ ./watch-faces/complication/fast_stopwatch_face.c \ ./watch-faces/complication/sunrise_sunset_face.c \ + ./watch-faces/demo/accel_interrupt_count_face.c \ ./watch-faces/demo/all_segments_face.c \ ./watch-faces/demo/character_set_face.c \ ./watch-faces/demo/float_demo_face.c \ diff --git a/movement/watch_faces/sensor/accel_interrupt_count_face.c b/watch-faces/demo/accel_interrupt_count_face.c similarity index 88% rename from movement/watch_faces/sensor/accel_interrupt_count_face.c rename to watch-faces/demo/accel_interrupt_count_face.c index 8d436aea..e7b61ffc 100644 --- a/movement/watch_faces/sensor/accel_interrupt_count_face.c +++ b/watch-faces/demo/accel_interrupt_count_face.c @@ -37,7 +37,7 @@ void accel_interrupt_handler(void) { } static void _accel_interrupt_count_face_update_display(accel_interrupt_count_state_t *state) { - char buf[11]; + char buf[7]; if (state->running) { watch_set_indicator(WATCH_INDICATOR_SIGNAL); @@ -46,8 +46,10 @@ static void _accel_interrupt_count_face_update_display(accel_interrupt_count_sta } // "AC"celerometer "IN"terrupts - snprintf(buf, 11, "AC1N%6ld", state->count); - watch_display_string(buf, 0); + watch_display_text(WATCH_POSITION_TOP_LEFT, "AC"); + watch_display_text(WATCH_POSITION_TOP_RIGHT, "1N"); + snprintf(buf, 7, "%6ld", state->count); + watch_display_text(WATCH_POSITION_BOTTOM, buf); printf("%s\n", buf); } @@ -95,8 +97,9 @@ bool accel_interrupt_count_face_loop(movement_event_t event, void *context) { case EVENT_TICK: { char buf[11]; - snprintf(buf, 11, "TH %4d ", state->new_threshold); - watch_display_string(buf, 0); + watch_display_text(WATCH_POSITION_TOP_RIGHT, " "); + watch_display_text_with_fallback(WATCH_POSITION_TOP, "W_THS", "TH"); + watch_display_float_with_best_effort(state->new_threshold * 0.125, " G"); printf("%s\n", buf); } break; @@ -123,10 +126,10 @@ bool accel_interrupt_count_face_loop(movement_event_t event, void *context) { case EVENT_ALARM_BUTTON_UP: if (state->running) { state->running = false; - watch_register_interrupt_callback(A4, NULL, INTERRUPT_TRIGGER_RISING); + watch_register_interrupt_callback(HAL_GPIO_A4_pin(), NULL, INTERRUPT_TRIGGER_RISING); } else { state->running = true; - watch_register_interrupt_callback(A4, accel_interrupt_handler, INTERRUPT_TRIGGER_RISING); + watch_register_interrupt_callback(HAL_GPIO_A4_pin(), accel_interrupt_handler, INTERRUPT_TRIGGER_RISING); } _accel_interrupt_count_face_update_display(state); break; diff --git a/movement/watch_faces/sensor/accel_interrupt_count_face.h b/watch-faces/demo/accel_interrupt_count_face.h similarity index 100% rename from movement/watch_faces/sensor/accel_interrupt_count_face.h rename to watch-faces/demo/accel_interrupt_count_face.h