* `watch_face_loop`
* `watch_face_resign`
-A fifth optional function, `watch_face_wants_background_task`, has not yet had its implementation ironed out, but it will be added to the guide at a later date.
+A fifth optional function, `watch_face_wants_background_task`, will be added to the guide at a later date. You may omit it.
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:
### watch_face_resign
-This function is called just before your watch face goes off screen. You should disable any peripherals you enabled in `watch_face_activate`. If you requested a tick frequency other than 1 Hz at any point in your code, **you must reset it to 1 Hz when you resign**. The watch_face_resign function is passed the same settings and context as the other functions.
+This function is called just before your watch face goes off screen. You should disable any peripherals you enabled in `watch_face_activate`. The watch_face_resign function is passed the same settings and context as the other functions.
Putting it into practice: the Pulsometer watch face
---------------------------------------------------
#### Watch Face Resignation
-The resign function doesn't have to do much here; it just resets the tick frequency to 1 Hz.
+The resign function doesn't have anything to do; it just has to be there.
```c
void pulsometer_face_resign(movement_settings_t *settings, void *context) {
(void) settings;
(void) context;
- movement_request_tick_frequency(1);
}
```
watch_faces[movement_state.current_watch_face].resign(&movement_state.settings, watch_face_contexts[movement_state.current_watch_face]);
movement_state.current_watch_face = movement_state.next_watch_face;
watch_clear_display();
+ movement_request_tick_frequency(1);
watch_faces[movement_state.current_watch_face].activate(&movement_state.settings, watch_face_contexts[movement_state.current_watch_face]);
event.subsecond = 0;
event.event_type = EVENT_ACTIVATE;
void world_clock_face_resign(movement_settings_t *settings, void *context) {
(void) settings;
(void) context;
- movement_request_tick_frequency(1);
}
void beats_face_resign(movement_settings_t *settings, void *context) {
(void) settings;
(void) context;
- movement_request_tick_frequency(1);
}
uint32_t clock2beats(uint32_t hours, uint32_t minutes, uint32_t seconds, uint32_t subseconds, int16_t utc_offset) {
void countdown_face_resign(movement_settings_t *settings, void *context) {
(void) settings;
- (void) context;
- movement_request_tick_frequency(1);
+ countdown_state_t *state = (countdown_state_t *)context;
+ if (state->mode == cd_setting) {
+ state->mode = cd_waiting;
+ }
}
(void) settings;
day_one_state_t *state = (day_one_state_t *)context;
- movement_request_tick_frequency(1);
-
// if the user changed their birth date, store it to the birth date register
if (state->birthday_changed) {
day_one_state_t *state = (day_one_state_t *)context;
void pulsometer_face_resign(movement_settings_t *settings, void *context) {
(void) settings;
(void) context;
- movement_request_tick_frequency(1);
}
void sunrise_sunset_face_resign(movement_settings_t *settings, void *context) {
(void) settings;
(void) context;
-
- movement_request_tick_frequency(1);
}
void character_set_face_resign(movement_settings_t *settings, void *context) {
(void) settings;
(void) context;
- movement_request_tick_frequency(1);
}
void demo_face_resign(movement_settings_t *settings, void *context) {
(void) settings;
(void) context;
- movement_request_tick_frequency(1);
}
(void) settings;
(void) context;
watch_set_led_off();
- movement_request_tick_frequency(1);
watch_store_backup_data(settings->reg, 0);
}
(void) settings;
(void) context;
watch_set_led_off();
- movement_request_tick_frequency(1);
watch_store_backup_data(settings->reg, 0);
}