summaryrefslogtreecommitdiffstats
path: root/movement
diff options
context:
space:
mode:
Diffstat (limited to 'movement')
-rw-r--r--movement/README.md28
-rw-r--r--movement/lib/TOTP-MCU/TOTP.c2
-rw-r--r--movement/lib/TOTP-MCU/sha1.c8
-rw-r--r--movement/movement.c27
-rw-r--r--movement/watch_faces/clock/simple_clock_face.h14
-rw-r--r--movement/watch_faces/clock/world_clock_face.h14
-rw-r--r--movement/watch_faces/complications/beats_face.c4
-rw-r--r--movement/watch_faces/complications/beats_face.h14
-rw-r--r--movement/watch_faces/complications/blinky_face.h16
-rw-r--r--movement/watch_faces/complications/countdown_face.h14
-rw-r--r--movement/watch_faces/complications/day_one_face.c2
-rw-r--r--movement/watch_faces/complications/day_one_face.h14
-rw-r--r--movement/watch_faces/complications/pulsometer_face.h16
-rw-r--r--movement/watch_faces/complications/stopwatch_face.h16
-rw-r--r--movement/watch_faces/complications/sunrise_sunset_face.h14
-rw-r--r--movement/watch_faces/complications/totp_face.h14
-rw-r--r--movement/watch_faces/demos/character_set_face.h16
-rw-r--r--movement/watch_faces/demos/demo_face.h16
-rw-r--r--movement/watch_faces/demos/hello_there_face.h14
-rw-r--r--movement/watch_faces/demos/lis2dh_logging_face.c18
-rw-r--r--movement/watch_faces/demos/lis2dh_logging_face.h14
-rw-r--r--movement/watch_faces/demos/voltage_face.c2
-rw-r--r--movement/watch_faces/demos/voltage_face.h16
-rw-r--r--movement/watch_faces/settings/preferences_face.h16
-rw-r--r--movement/watch_faces/settings/set_time_face.h14
-rw-r--r--movement/watch_faces/thermistor/thermistor_logging_face.h14
-rw-r--r--movement/watch_faces/thermistor/thermistor_readout_face.h14
27 files changed, 198 insertions, 173 deletions
diff --git a/movement/README.md b/movement/README.md
index 0e1c3b40..5d5b0e2f 100644
--- a/movement/README.md
+++ b/movement/README.md
@@ -22,13 +22,13 @@ A fifth optional function, `watch_face_wants_background_task`, will be added to
To create a new watch face, you should create a new C header and source file in the watch-faces folder (i.e. for a watch face that displays moon phases: `moon_phase_face.h`, `moon_phase_face.c`), and implement these functions with your own unique prefix (i.e. `moon_phase_face_setup`). Then declare your watch face in your header file as follows:
```c
-static const watch_face_t moon_phase_face = {
- moon_phase_face_setup,
- moon_phase_face_activate,
- moon_phase_face_loop,
- moon_phase_face_resign,
- NULL // or moon_phase_face_wants_background_task, if you implemented this function
-};
+#define moon_phase_face ((const watch_face_t){ \
+ moon_phase_face_setup, \
+ moon_phase_face_activate, \
+ moon_phase_face_loop, \
+ moon_phase_face_resign, \
+ NULL, /* or moon_phase_face_wants_background_task, if you implemented this function */ \
+})
```
This section will go over how each function works. The section headings use the watch_face prefix, but know that you should implement each function with your own prefix as described above.
@@ -96,13 +96,13 @@ void pulsometer_face_activate(movement_settings_t *settings, void *context);
bool pulsometer_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void pulsometer_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t pulsometer_face = {
- pulsometer_face_setup,
- pulsometer_face_activate,
- pulsometer_face_loop,
- pulsometer_face_resign,
- NULL
-};
+#define pulsometer_face ((const watch_face_t){ \
+ pulsometer_face_setup, \
+ pulsometer_face_activate, \
+ pulsometer_face_loop, \
+ pulsometer_face_resign, \
+ NULL, \
+})
```
### pulsometer_face.c
diff --git a/movement/lib/TOTP-MCU/TOTP.c b/movement/lib/TOTP-MCU/TOTP.c
index d977d06e..02858611 100644
--- a/movement/lib/TOTP-MCU/TOTP.c
+++ b/movement/lib/TOTP-MCU/TOTP.c
@@ -17,7 +17,7 @@ void setTimezone(uint8_t timezone){
_timeZoneOffset = timezone;
}
-uint32_t TimeStruct2Timestamp(struct tm time){
+static uint32_t TimeStruct2Timestamp(struct tm time){
//time.tm_mon -= 1;
//time.tm_year -= 1900;
return mktime(&(time)) - (_timeZoneOffset * 3600) - 2208988800;
diff --git a/movement/lib/TOTP-MCU/sha1.c b/movement/lib/TOTP-MCU/sha1.c
index 3ac14856..21a24fa5 100644
--- a/movement/lib/TOTP-MCU/sha1.c
+++ b/movement/lib/TOTP-MCU/sha1.c
@@ -34,11 +34,11 @@ void init(void) {
bufferOffset = 0;
}
-uint32_t rol32(uint32_t number, uint8_t bits) {
+static uint32_t rol32(uint32_t number, uint8_t bits) {
return ((number << bits) | (uint32_t)(number >> (32-bits)));
}
-void hashBlock(void) {
+static void hashBlock(void) {
uint8_t i;
uint32_t a,b,c,d,e,t;
@@ -75,7 +75,7 @@ void hashBlock(void) {
state.w[4] += e;
}
-void addUncounted(uint8_t data) {
+static void addUncounted(uint8_t data) {
buffer.b[bufferOffset ^ 3] = data;
bufferOffset++;
if (bufferOffset == BLOCK_LENGTH) {
@@ -97,7 +97,7 @@ void writeArray(uint8_t *buffer, uint8_t size){
}
}
-void pad(void) {
+static void pad(void) {
// Implement SHA-1 padding (fips180-2 ��5.1.1)
// Pad with 0x80 followed by 0x00 until the end of the block
diff --git a/movement/movement.c b/movement/movement.c
index 3dc1c060..d15c349f 100644
--- a/movement/movement.c
+++ b/movement/movement.c
@@ -29,6 +29,10 @@
#include "movement.h"
#include "movement_config.h"
+#if __EMSCRIPTEN__
+#include <emscripten.h>
+#endif
+
movement_state_t movement_state;
void * watch_face_contexts[MOVEMENT_NUM_FACES];
watch_date_time scheduled_tasks[MOVEMENT_NUM_FACES];
@@ -149,7 +153,16 @@ static void _movement_handle_scheduled_tasks(void) {
void movement_request_tick_frequency(uint8_t freq) {
if (freq == 128) return; // Movement uses the 128 Hz tick internally
- RTC->MODE2.INTENCLR.reg = 0xFE; // disable all callbacks except the 128 Hz one
+
+ // disable all callbacks except the 128 Hz one
+#if __EMSCRIPTEN__
+ for (int i = 1; i < 128; i = i << 1) {
+ watch_rtc_disable_periodic_callback(i);
+ }
+#else
+ RTC->MODE2.INTENCLR.reg = 0xFE;
+#endif
+
movement_state.subsecond = 0;
movement_state.tick_frequency = freq;
if (freq) watch_rtc_register_periodic_callback(cb_tick, freq);
@@ -215,6 +228,18 @@ void app_init(void) {
movement_state.light_ticks = -1;
movement_state.alarm_ticks = -1;
_movement_reset_inactivity_countdown();
+
+#if __EMSCRIPTEN__
+ int32_t time_zone_offset = EM_ASM_INT({
+ return -new Date().getTimezoneOffset();
+ });
+ for (int i = 0, count = sizeof(movement_timezone_offsets) / sizeof(movement_timezone_offsets[0]); i < count; i++) {
+ if (movement_timezone_offsets[i] == time_zone_offset) {
+ movement_state.settings.bit.time_zone = i;
+ break;
+ }
+ }
+#endif
}
void app_wake_from_backup(void) {
diff --git a/movement/watch_faces/clock/simple_clock_face.h b/movement/watch_faces/clock/simple_clock_face.h
index 98f997bf..6e8665bf 100644
--- a/movement/watch_faces/clock/simple_clock_face.h
+++ b/movement/watch_faces/clock/simple_clock_face.h
@@ -39,12 +39,12 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting
void simple_clock_face_resign(movement_settings_t *settings, void *context);
bool simple_clock_face_wants_background_task(movement_settings_t *settings, void *context);
-static const watch_face_t simple_clock_face = {
- simple_clock_face_setup,
- simple_clock_face_activate,
- simple_clock_face_loop,
- simple_clock_face_resign,
- simple_clock_face_wants_background_task
-};
+#define simple_clock_face ((const watch_face_t){ \
+ simple_clock_face_setup, \
+ simple_clock_face_activate, \
+ simple_clock_face_loop, \
+ simple_clock_face_resign, \
+ simple_clock_face_wants_background_task, \
+})
#endif // SIMPLE_CLOCK_FACE_H_
diff --git a/movement/watch_faces/clock/world_clock_face.h b/movement/watch_faces/clock/world_clock_face.h
index b519bc85..36960f53 100644
--- a/movement/watch_faces/clock/world_clock_face.h
+++ b/movement/watch_faces/clock/world_clock_face.h
@@ -46,12 +46,12 @@ void world_clock_face_resign(movement_settings_t *settings, void *context);
uint8_t world_clock_face_get_weekday(uint16_t day, uint16_t month, uint16_t year);
-static const watch_face_t world_clock_face = {
- world_clock_face_setup,
- world_clock_face_activate,
- world_clock_face_loop,
- world_clock_face_resign,
- NULL
-};
+#define world_clock_face ((const watch_face_t){ \
+ world_clock_face_setup, \
+ world_clock_face_activate, \
+ world_clock_face_loop, \
+ world_clock_face_resign, \
+ NULL, \
+})
#endif // WORLD_CLOCK_FACE_H_
diff --git a/movement/watch_faces/complications/beats_face.c b/movement/watch_faces/complications/beats_face.c
index d1466b33..df31ad1c 100644
--- a/movement/watch_faces/complications/beats_face.c
+++ b/movement/watch_faces/complications/beats_face.c
@@ -45,7 +45,7 @@ bool beats_face_loop(movement_event_t event, movement_settings_t *settings, void
state->next_subsecond_update = (event.subsecond + 1 + (BEAT_REFRESH_FREQUENCY * 2 / 3)) % BEAT_REFRESH_FREQUENCY;
state->last_centibeat_displayed = centibeats;
}
- sprintf(buf, "bt %6ld", centibeats);
+ sprintf(buf, "bt %6lu", centibeats);
watch_display_string(buf, 0);
break;
@@ -53,7 +53,7 @@ bool beats_face_loop(movement_event_t event, movement_settings_t *settings, void
if (!watch_tick_animation_is_running()) watch_start_tick_animation(432);
date_time = watch_rtc_get_date_time();
centibeats = clock2beats(date_time.unit.hour, date_time.unit.minute, date_time.unit.second, event.subsecond, movement_timezone_offsets[settings->bit.time_zone]);
- sprintf(buf, "bt %4ld ", centibeats / 100);
+ sprintf(buf, "bt %4lu ", centibeats / 100);
watch_display_string(buf, 0);
break;
diff --git a/movement/watch_faces/complications/beats_face.h b/movement/watch_faces/complications/beats_face.h
index f11126d1..2bbbc26d 100644
--- a/movement/watch_faces/complications/beats_face.h
+++ b/movement/watch_faces/complications/beats_face.h
@@ -14,12 +14,12 @@ void beats_face_activate(movement_settings_t *settings, void *context);
bool beats_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void beats_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t beats_face = {
- beats_face_setup,
- beats_face_activate,
- beats_face_loop,
- beats_face_resign,
- NULL
-};
+#define beats_face ((const watch_face_t){ \
+ beats_face_setup, \
+ beats_face_activate, \
+ beats_face_loop, \
+ beats_face_resign, \
+ NULL, \
+})
#endif // BEATS_FACE_H_ \ No newline at end of file
diff --git a/movement/watch_faces/complications/blinky_face.h b/movement/watch_faces/complications/blinky_face.h
index 14f0e143..e966ab1d 100644
--- a/movement/watch_faces/complications/blinky_face.h
+++ b/movement/watch_faces/complications/blinky_face.h
@@ -38,12 +38,12 @@ void blinky_face_activate(movement_settings_t *settings, void *context);
bool blinky_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void blinky_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t blinky_face = {
- blinky_face_setup,
- blinky_face_activate,
- blinky_face_loop,
- blinky_face_resign,
- NULL
-};
+#define blinky_face ((const watch_face_t){ \
+ blinky_face_setup, \
+ blinky_face_activate, \
+ blinky_face_loop, \
+ blinky_face_resign, \
+ NULL, \
+})
-#endif // BLINKY_FACE_H_ \ No newline at end of file
+#endif // BLINKY_FACE_H_
diff --git a/movement/watch_faces/complications/countdown_face.h b/movement/watch_faces/complications/countdown_face.h
index 1a5d2c78..657c6377 100644
--- a/movement/watch_faces/complications/countdown_face.h
+++ b/movement/watch_faces/complications/countdown_face.h
@@ -58,12 +58,12 @@ void countdown_face_activate(movement_settings_t *settings, void *context);
bool countdown_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void countdown_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t countdown_face = {
- countdown_face_setup,
- countdown_face_activate,
- countdown_face_loop,
- countdown_face_resign,
- NULL
-};
+#define countdown_face ((const watch_face_t){ \
+ countdown_face_setup, \
+ countdown_face_activate, \
+ countdown_face_loop, \
+ countdown_face_resign, \
+ NULL, \
+})
#endif // COUNTDOWN_FACE_H_
diff --git a/movement/watch_faces/complications/day_one_face.c b/movement/watch_faces/complications/day_one_face.c
index 18d02d4d..99433990 100644
--- a/movement/watch_faces/complications/day_one_face.c
+++ b/movement/watch_faces/complications/day_one_face.c
@@ -37,7 +37,7 @@ static void _day_one_face_update(day_one_state_t state) {
watch_date_time date_time = watch_rtc_get_date_time();
uint32_t julian_date = _day_one_face_juliandaynum(date_time.unit.year + WATCH_RTC_REFERENCE_YEAR, date_time.unit.month, date_time.unit.day);
uint32_t julian_birthdate = _day_one_face_juliandaynum(state.birth_year, state.birth_month, state.birth_day);
- sprintf(buf, "DA %6ld", julian_date - julian_birthdate);
+ sprintf(buf, "DA %6lu", julian_date - julian_birthdate);
watch_display_string(buf, 0);
}
diff --git a/movement/watch_faces/complications/day_one_face.h b/movement/watch_faces/complications/day_one_face.h
index f39c7927..ab8372bf 100644
--- a/movement/watch_faces/complications/day_one_face.h
+++ b/movement/watch_faces/complications/day_one_face.h
@@ -44,12 +44,12 @@ void day_one_face_activate(movement_settings_t *settings, void *context);
bool day_one_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void day_one_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t day_one_face = {
- day_one_face_setup,
- day_one_face_activate,
- day_one_face_loop,
- day_one_face_resign,
- NULL
-};
+#define day_one_face ((const watch_face_t){ \
+ day_one_face_setup, \
+ day_one_face_activate, \
+ day_one_face_loop, \
+ day_one_face_resign, \
+ NULL, \
+})
#endif // DAY_ONE_FACE_H_
diff --git a/movement/watch_faces/complications/pulsometer_face.h b/movement/watch_faces/complications/pulsometer_face.h
index 65188604..600201e9 100644
--- a/movement/watch_faces/complications/pulsometer_face.h
+++ b/movement/watch_faces/complications/pulsometer_face.h
@@ -38,12 +38,12 @@ void pulsometer_face_activate(movement_settings_t *settings, void *context);
bool pulsometer_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void pulsometer_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t pulsometer_face = {
- pulsometer_face_setup,
- pulsometer_face_activate,
- pulsometer_face_loop,
- pulsometer_face_resign,
- NULL
-};
+#define pulsometer_face ((const watch_face_t){ \
+ pulsometer_face_setup, \
+ pulsometer_face_activate, \
+ pulsometer_face_loop, \
+ pulsometer_face_resign, \
+ NULL, \
+})
-#endif // PULSOMETER_FACE_H_ \ No newline at end of file
+#endif // PULSOMETER_FACE_H_
diff --git a/movement/watch_faces/complications/stopwatch_face.h b/movement/watch_faces/complications/stopwatch_face.h
index ff0c1796..c6e3aadb 100644
--- a/movement/watch_faces/complications/stopwatch_face.h
+++ b/movement/watch_faces/complications/stopwatch_face.h
@@ -15,12 +15,12 @@ void stopwatch_face_activate(movement_settings_t *settings, void *context);
bool stopwatch_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void stopwatch_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t stopwatch_face = {
- stopwatch_face_setup,
- stopwatch_face_activate,
- stopwatch_face_loop,
- stopwatch_face_resign,
- NULL
-};
+#define stopwatch_face ((const watch_face_t){ \
+ stopwatch_face_setup, \
+ stopwatch_face_activate, \
+ stopwatch_face_loop, \
+ stopwatch_face_resign, \
+ NULL, \
+})
-#endif // STOPWATCH_FACE_H_ \ No newline at end of file
+#endif // STOPWATCH_FACE_H_
diff --git a/movement/watch_faces/complications/sunrise_sunset_face.h b/movement/watch_faces/complications/sunrise_sunset_face.h
index 196b9db0..826d5e95 100644
--- a/movement/watch_faces/complications/sunrise_sunset_face.h
+++ b/movement/watch_faces/complications/sunrise_sunset_face.h
@@ -52,12 +52,12 @@ void sunrise_sunset_face_activate(movement_settings_t *settings, void *context);
bool sunrise_sunset_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void sunrise_sunset_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t sunrise_sunset_face = {
- sunrise_sunset_face_setup,
- sunrise_sunset_face_activate,
- sunrise_sunset_face_loop,
- sunrise_sunset_face_resign,
- NULL
-};
+#define sunrise_sunset_face ((const watch_face_t){ \
+ sunrise_sunset_face_setup, \
+ sunrise_sunset_face_activate, \
+ sunrise_sunset_face_loop, \
+ sunrise_sunset_face_resign, \
+ NULL, \
+})
#endif // SUNRISE_SUNSET_FACE_H_
diff --git a/movement/watch_faces/complications/totp_face.h b/movement/watch_faces/complications/totp_face.h
index 1e2c5c02..dfa4a6d0 100644
--- a/movement/watch_faces/complications/totp_face.h
+++ b/movement/watch_faces/complications/totp_face.h
@@ -15,12 +15,12 @@ void totp_face_activate(movement_settings_t *settings, void *context);
bool totp_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void totp_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t totp_face = {
- totp_face_setup,
- totp_face_activate,
- totp_face_loop,
- totp_face_resign,
- NULL
-};
+#define totp_face ((const watch_face_t){ \
+ totp_face_setup, \
+ totp_face_activate, \
+ totp_face_loop, \
+ totp_face_resign, \
+ NULL, \
+})
#endif // TOTP_FACE_H_
diff --git a/movement/watch_faces/demos/character_set_face.h b/movement/watch_faces/demos/character_set_face.h
index a6c8e17d..82627aed 100644
--- a/movement/watch_faces/demos/character_set_face.h
+++ b/movement/watch_faces/demos/character_set_face.h
@@ -32,12 +32,12 @@ void character_set_face_activate(movement_settings_t *settings, void *context);
bool character_set_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void character_set_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t character_set_face = {
- character_set_face_setup,
- character_set_face_activate,
- character_set_face_loop,
- character_set_face_resign,
- NULL
-};
+#define character_set_face ((const watch_face_t){ \
+ character_set_face_setup, \
+ character_set_face_activate, \
+ character_set_face_loop, \
+ character_set_face_resign, \
+ NULL, \
+})
-#endif // CHARACTER_SET_FACE_H_ \ No newline at end of file
+#endif // CHARACTER_SET_FACE_H_
diff --git a/movement/watch_faces/demos/demo_face.h b/movement/watch_faces/demos/demo_face.h
index 6eb4298d..026e0d10 100644
--- a/movement/watch_faces/demos/demo_face.h
+++ b/movement/watch_faces/demos/demo_face.h
@@ -32,12 +32,12 @@ void demo_face_activate(movement_settings_t *settings, void *context);
bool demo_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void demo_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t demo_face = {
- demo_face_setup,
- demo_face_activate,
- demo_face_loop,
- demo_face_resign,
- NULL
-};
+#define demo_face ((const watch_face_t){ \
+ demo_face_setup, \
+ demo_face_activate, \
+ demo_face_loop, \
+ demo_face_resign, \
+ NULL, \
+})
-#endif // DEMO_FACE_H_ \ No newline at end of file
+#endif // DEMO_FACE_H_
diff --git a/movement/watch_faces/demos/hello_there_face.h b/movement/watch_faces/demos/hello_there_face.h
index c444e016..1140bb20 100644
--- a/movement/watch_faces/demos/hello_there_face.h
+++ b/movement/watch_faces/demos/hello_there_face.h
@@ -37,12 +37,12 @@ void hello_there_face_activate(movement_settings_t *settings, void *context);
bool hello_there_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void hello_there_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t hello_there_face = {
- hello_there_face_setup,
- hello_there_face_activate,
- hello_there_face_loop,
- hello_there_face_resign,
- NULL
-};
+#define hello_there_face ((const watch_face_t){ \
+ hello_there_face_setup, \
+ hello_there_face_activate, \
+ hello_there_face_loop, \
+ hello_there_face_resign, \
+ NULL, \
+})
#endif // HELLO_THERE_FACE_H_
diff --git a/movement/watch_faces/demos/lis2dh_logging_face.c b/movement/watch_faces/demos/lis2dh_logging_face.c
index 08b265b6..31d1cad7 100644
--- a/movement/watch_faces/demos/lis2dh_logging_face.c
+++ b/movement/watch_faces/demos/lis2dh_logging_face.c
@@ -36,10 +36,11 @@
// Pressing the alarm button enters the log mode, where the main display shows the number of interrupts detected in each of the last
// 24 hours (the hour is shown in the top right digit and AM/PM indicator, if the clock is set to 12 hour mode)
-static void _lis2dh_logging_face_update_display(movement_settings_t *settings, lis2dh_logger_state_t *logger_state, lis2dh_interrupt_state interrupt_state, watch_date_time date_time) {
+static void _lis2dh_logging_face_update_display(movement_settings_t *settings, lis2dh_logger_state_t *logger_state, lis2dh_interrupt_state interrupt_state) {
char buf[14];
char time_indication_character;
int8_t pos;
+ watch_date_time date_time;
if (logger_state->log_ticks) {
pos = (logger_state->data_points - 1 - logger_state->display_index) % LIS2DH_LOGGING_NUM_DATA_POINTS;
@@ -58,16 +59,16 @@ static void _lis2dh_logging_face_update_display(movement_settings_t *settings, l
}
switch (logger_state->axis_index) {
case 0:
- sprintf(buf, "3A%2d%02d%4ld", date_time.unit.hour, date_time.unit.minute, logger_state->data[pos].x_interrupts + logger_state->data[pos].y_interrupts + logger_state->data[pos].z_interrupts);
+ sprintf(buf, "3A%2d%02d%4lu", date_time.unit.hour, date_time.unit.minute, logger_state->data[pos].x_interrupts + logger_state->data[pos].y_interrupts + logger_state->data[pos].z_interrupts);
break;
case 1:
- sprintf(buf, "XA%2d%02d%4ld", date_time.unit.hour, date_time.unit.minute, logger_state->data[pos].x_interrupts);
+ sprintf(buf, "XA%2d%02d%4lu", date_time.unit.hour, date_time.unit.minute, logger_state->data[pos].x_interrupts);
break;
case 2:
- sprintf(buf, "YA%2d%02d%4ld", date_time.unit.hour, date_time.unit.minute, logger_state->data[pos].y_interrupts);
+ sprintf(buf, "YA%2d%02d%4lu", date_time.unit.hour, date_time.unit.minute, logger_state->data[pos].y_interrupts);
break;
case 3:
- sprintf(buf, "ZA%2d%02d%4ld", date_time.unit.hour, date_time.unit.minute, logger_state->data[pos].z_interrupts);
+ sprintf(buf, "ZA%2d%02d%4lu", date_time.unit.hour, date_time.unit.minute, logger_state->data[pos].z_interrupts);
break;
}
}
@@ -145,7 +146,6 @@ void lis2dh_logging_face_activate(movement_settings_t *settings, void *context)
bool lis2dh_logging_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
lis2dh_logger_state_t *logger_state = (lis2dh_logger_state_t *)context;
lis2dh_interrupt_state interrupt_state = 0;
- watch_date_time date_time;
switch (event.event_type) {
case EVENT_MODE_BUTTON_UP:
@@ -157,13 +157,13 @@ bool lis2dh_logging_face_loop(movement_event_t event, movement_settings_t *setti
case EVENT_LIGHT_BUTTON_DOWN:
logger_state->axis_index = (logger_state->axis_index + 1) % 4;
logger_state->log_ticks = 255;
- _lis2dh_logging_face_update_display(settings, logger_state, interrupt_state, date_time);
+ _lis2dh_logging_face_update_display(settings, logger_state, interrupt_state);
break;
case EVENT_ALARM_BUTTON_UP:
if (logger_state->log_ticks) logger_state->display_index = (logger_state->display_index + 1) % LIS2DH_LOGGING_NUM_DATA_POINTS;
logger_state->log_ticks = 255;
logger_state->axis_index = 0;
- _lis2dh_logging_face_update_display(settings, logger_state, interrupt_state, date_time);
+ _lis2dh_logging_face_update_display(settings, logger_state, interrupt_state);
break;
case EVENT_ACTIVATE:
case EVENT_TICK:
@@ -182,7 +182,7 @@ bool lis2dh_logging_face_loop(movement_event_t event, movement_settings_t *setti
} else {
watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
}
- _lis2dh_logging_face_update_display(settings, logger_state, interrupt_state, date_time);
+ _lis2dh_logging_face_update_display(settings, logger_state, interrupt_state);
break;
case EVENT_BACKGROUND_TASK:
_lis2dh_logging_face_log_data(logger_state);
diff --git a/movement/watch_faces/demos/lis2dh_logging_face.h b/movement/watch_faces/demos/lis2dh_logging_face.h
index 22ecd2d9..49366542 100644
--- a/movement/watch_faces/demos/lis2dh_logging_face.h
+++ b/movement/watch_faces/demos/lis2dh_logging_face.h
@@ -55,12 +55,12 @@ bool lis2dh_logging_face_loop(movement_event_t event, movement_settings_t *setti
void lis2dh_logging_face_resign(movement_settings_t *settings, void *context);
bool lis2dh_logging_face_wants_background_task(movement_settings_t *settings, void *context);
-static const watch_face_t lis2dh_logging_face = {
- lis2dh_logging_face_setup,
- lis2dh_logging_face_activate,
- lis2dh_logging_face_loop,
- lis2dh_logging_face_resign,
- lis2dh_logging_face_wants_background_task
-};
+#define lis2dh_logging_face ((const watch_face_t){ \
+ lis2dh_logging_face_setup, \
+ lis2dh_logging_face_activate, \
+ lis2dh_logging_face_loop, \
+ lis2dh_logging_face_resign, \
+ lis2dh_logging_face_wants_background_task, \
+})
#endif // LIS2DH_LOGGING_FACE_H_
diff --git a/movement/watch_faces/demos/voltage_face.c b/movement/watch_faces/demos/voltage_face.c
index 4e5fecc1..24346aa3 100644
--- a/movement/watch_faces/demos/voltage_face.c
+++ b/movement/watch_faces/demos/voltage_face.c
@@ -86,6 +86,6 @@ void voltage_face_resign(movement_settings_t *settings, void *context) {
(void) settings;
(void) context;
// make sure to restore the default in the end.
- watch_set_analog_reference_voltage(ADC_REFCTRL_REFSEL_INTVCC2_Val);
+ watch_set_analog_reference_voltage(ADC_REFERENCE_VCC);
watch_disable_adc();
}
diff --git a/movement/watch_faces/demos/voltage_face.h b/movement/watch_faces/demos/voltage_face.h
index 07d9e473..dc5e631b 100644
--- a/movement/watch_faces/demos/voltage_face.h
+++ b/movement/watch_faces/demos/voltage_face.h
@@ -32,12 +32,12 @@ void voltage_face_activate(movement_settings_t *settings, void *context);
bool voltage_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void voltage_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t voltage_face = {
- voltage_face_setup,
- voltage_face_activate,
- voltage_face_loop,
- voltage_face_resign,
- NULL
-};
+#define voltage_face ((const watch_face_t){ \
+ voltage_face_setup, \
+ voltage_face_activate, \
+ voltage_face_loop, \
+ voltage_face_resign, \
+ NULL, \
+})
-#endif // VOLTAGE_FACE_H_ \ No newline at end of file
+#endif // VOLTAGE_FACE_H_
diff --git a/movement/watch_faces/settings/preferences_face.h b/movement/watch_faces/settings/preferences_face.h
index 11f9dc43..b178bfd2 100644
--- a/movement/watch_faces/settings/preferences_face.h
+++ b/movement/watch_faces/settings/preferences_face.h
@@ -32,12 +32,12 @@ void preferences_face_activate(movement_settings_t *settings, void *context);
bool preferences_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void preferences_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t preferences_face = {
- preferences_face_setup,
- preferences_face_activate,
- preferences_face_loop,
- preferences_face_resign,
- NULL
-};
+#define preferences_face ((const watch_face_t){ \
+ preferences_face_setup, \
+ preferences_face_activate, \
+ preferences_face_loop, \
+ preferences_face_resign, \
+ NULL, \
+})
-#endif // PREFERENCES_FACE_H_ \ No newline at end of file
+#endif // PREFERENCES_FACE_H_
diff --git a/movement/watch_faces/settings/set_time_face.h b/movement/watch_faces/settings/set_time_face.h
index ebc3d8d4..c86b6376 100644
--- a/movement/watch_faces/settings/set_time_face.h
+++ b/movement/watch_faces/settings/set_time_face.h
@@ -32,12 +32,12 @@ void set_time_face_activate(movement_settings_t *settings, void *context);
bool set_time_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void set_time_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t set_time_face = {
- set_time_face_setup,
- set_time_face_activate,
- set_time_face_loop,
- set_time_face_resign,
- NULL
-};
+#define set_time_face ((const watch_face_t){ \
+ set_time_face_setup, \
+ set_time_face_activate, \
+ set_time_face_loop, \
+ set_time_face_resign, \
+ NULL, \
+})
#endif // SET_TIME_FACE_H_
diff --git a/movement/watch_faces/thermistor/thermistor_logging_face.h b/movement/watch_faces/thermistor/thermistor_logging_face.h
index effb8822..4ba593ec 100644
--- a/movement/watch_faces/thermistor/thermistor_logging_face.h
+++ b/movement/watch_faces/thermistor/thermistor_logging_face.h
@@ -48,12 +48,12 @@ bool thermistor_logging_face_loop(movement_event_t event, movement_settings_t *s
void thermistor_logging_face_resign(movement_settings_t *settings, void *context);
bool thermistor_logging_face_wants_background_task(movement_settings_t *settings, void *context);
-static const watch_face_t thermistor_logging_face = {
- thermistor_logging_face_setup,
- thermistor_logging_face_activate,
- thermistor_logging_face_loop,
- thermistor_logging_face_resign,
- thermistor_logging_face_wants_background_task
-};
+#define thermistor_logging_face ((const watch_face_t){ \
+ thermistor_logging_face_setup, \
+ thermistor_logging_face_activate, \
+ thermistor_logging_face_loop, \
+ thermistor_logging_face_resign, \
+ thermistor_logging_face_wants_background_task, \
+})
#endif // THERMISTOR_LOGGING_FACE_H_
diff --git a/movement/watch_faces/thermistor/thermistor_readout_face.h b/movement/watch_faces/thermistor/thermistor_readout_face.h
index 5b14fc5b..7361164e 100644
--- a/movement/watch_faces/thermistor/thermistor_readout_face.h
+++ b/movement/watch_faces/thermistor/thermistor_readout_face.h
@@ -32,12 +32,12 @@ void thermistor_readout_face_activate(movement_settings_t *settings, void *conte
bool thermistor_readout_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
void thermistor_readout_face_resign(movement_settings_t *settings, void *context);
-static const watch_face_t thermistor_readout_face = {
- thermistor_readout_face_setup,
- thermistor_readout_face_activate,
- thermistor_readout_face_loop,
- thermistor_readout_face_resign,
- NULL
-};
+#define thermistor_readout_face ((const watch_face_t){ \
+ thermistor_readout_face_setup, \
+ thermistor_readout_face_activate, \
+ thermistor_readout_face_loop, \
+ thermistor_readout_face_resign, \
+ NULL, \
+})
#endif // THERMISTOR_READOUT_FACE_H_