]> git.earman.xyz Git - sensor-watch.git/commitdiff
faces/clock: move structure definition
authorMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Sat, 24 Feb 2024 21:40:21 +0000 (18:40 -0300)
committerMatheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Sun, 25 Feb 2024 18:24:14 +0000 (15:24 -0300)
Instances of the clock state structure
are only passed to the clock face itself
and only via the opaque context pointer.
No other code uses it.

Thus there is no need to expose it in a header file.
So make it an implementation detail of the watch face
by localizing it inside the translation unit.

movement/watch_faces/clock/clock_face.c
movement/watch_faces/clock/clock_face.h

index a18bc3a1d21b0a0b6e563bfa047fd3f04c6d0888..070968a78ef97838bcb0b7f010c0939f0a0290c6 100644 (file)
 #include "watch_utility.h"
 #include "watch_private_display.h"
 
+typedef struct {
+    uint32_t previous_date_time;
+    uint8_t last_battery_check;
+    uint8_t watch_face_index;
+    bool signal_enabled;
+    bool battery_low;
+    bool alarm_enabled;
+} clock_state_t;
+
 static void _update_alarm_indicator(bool settings_alarm_enabled, clock_state_t *state) {
     state->alarm_enabled = settings_alarm_enabled;
     if (state->alarm_enabled) watch_set_indicator(WATCH_INDICATOR_SIGNAL);
index d2aa5ecb413f0ce46c1d1335caf5ca78a764d106..f973f2707da64c656475935291efdb749f308a1b 100644 (file)
 
 #include "movement.h"
 
-typedef struct {
-    uint32_t previous_date_time;
-    uint8_t last_battery_check;
-    uint8_t watch_face_index;
-    bool signal_enabled;
-    bool battery_low;
-    bool alarm_enabled;
-} clock_state_t;
-
 void clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
 void clock_face_activate(movement_settings_t *settings, void *context);
 bool clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context);