rename stock_stopwatch -> fast_stopwatch
This commit is contained in:
parent
78f23dc215
commit
32a49a5e11
@ -64,7 +64,7 @@
|
||||
#include "ratemeter_face.h"
|
||||
#include "rpn_calculator_alt_face.h"
|
||||
#include "weeknumber_clock_face.h"
|
||||
#include "stock_stopwatch_face.h"
|
||||
#include "fast_stopwatch_face.h"
|
||||
#include "tachymeter_face.h"
|
||||
#include "nanosec_face.h"
|
||||
#include "finetune_face.h"
|
||||
|
||||
@ -34,11 +34,11 @@
|
||||
* IMPORTANT: This watch face uses the same TC2 callback counter as the Stock Stopwatch
|
||||
* watch-face. It works through calling a global handler function. The two watch-faces
|
||||
* therefore can't coexist within the same firmware. If you want to compile this watch-face
|
||||
* then you need to remove the line <../watch_faces/complication/stock_stopwatch_face.c \>
|
||||
* then you need to remove the line <../watch_faces/complication/fast_stopwatch_face.c \>
|
||||
* from the Makefile.
|
||||
*/
|
||||
|
||||
// FROM stock_stopwatch_face.c ////////////////////////////////////////////////
|
||||
// FROM fast_stopwatch_face.c ////////////////////////////////////////////////
|
||||
// Copyright (c) 2022 Andreas Nebinger
|
||||
|
||||
#if __EMSCRIPTEN__
|
||||
@ -107,7 +107,7 @@ static void _dual_timer_cb_initialize() {
|
||||
NVIC_EnableIRQ (TC2_IRQn);
|
||||
}
|
||||
|
||||
// you need to take stock_stopwatch.c out of the Makefile or this will create a conflict
|
||||
// you need to take fast_stopwatch.c out of the Makefile or this will create a conflict
|
||||
// you have to choose between one of the stopwatches
|
||||
void TC2_Handler(void) {
|
||||
// interrupt handler for TC2 (globally!)
|
||||
|
||||
@ -63,7 +63,7 @@
|
||||
* IMPORTANT: This watch face uses the same TC2 callback counter as the Stock Stopwatch
|
||||
* watch-face. It works through calling a global handler function. The two watch-faces
|
||||
* therefore can't coexist within the same firmware. If you want to compile this watch-face
|
||||
* then you need to remove the line <../watch_faces/complication/stock_stopwatch_face.c \>
|
||||
* then you need to remove the line <../watch_faces/complication/fast_stopwatch_face.c \>
|
||||
* from the Makefile.
|
||||
*/
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@
|
||||
* when the timer is stopped resets it.
|
||||
*
|
||||
* This face does not count sub-seconds.
|
||||
* See also: "stock_stopwatch_face.h"
|
||||
* See also: "fast_stopwatch_face.h"
|
||||
*/
|
||||
|
||||
#include "movement.h"
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
|
||||
const watch_face_t watch_faces[] = {
|
||||
clock_face,
|
||||
stock_stopwatch_face,
|
||||
fast_stopwatch_face,
|
||||
beats_face,
|
||||
world_clock_face,
|
||||
countdown_face,
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
#include "beats_face.h"
|
||||
#include "world_clock_face.h"
|
||||
#include "countdown_face.h"
|
||||
#include "stock_stopwatch_face.h"
|
||||
#include "fast_stopwatch_face.h"
|
||||
#include "set_time_face.h"
|
||||
#include "preferences_face.h"
|
||||
// New includes go above this line.
|
||||
|
||||
@ -4,6 +4,6 @@ SRCS += \
|
||||
./watch-faces/clock/beats_face.c \
|
||||
./watch-faces/clock/world_clock_face.c \
|
||||
./watch-faces/complication/countdown_face.c \
|
||||
./watch-faces/complication/stock_stopwatch_face.c \
|
||||
./watch-faces/complication/fast_stopwatch_face.c \
|
||||
./watch-faces/settings/set_time_face.c \
|
||||
./watch-faces/settings/preferences_face.c \
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "stock_stopwatch_face.h"
|
||||
#include "fast_stopwatch_face.h"
|
||||
#include "watch.h"
|
||||
#include "watch_common_display.h"
|
||||
#include "watch_utility.h"
|
||||
@ -209,12 +209,12 @@ static inline void _set_colon() {
|
||||
_colon = true;
|
||||
}
|
||||
|
||||
void stock_stopwatch_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
void fast_stopwatch_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) watch_face_index;
|
||||
if (*context_ptr == NULL) {
|
||||
*context_ptr = malloc(sizeof(stock_stopwatch_state_t));
|
||||
memset(*context_ptr, 0, sizeof(stock_stopwatch_state_t));
|
||||
stock_stopwatch_state_t *state = (stock_stopwatch_state_t *)*context_ptr;
|
||||
*context_ptr = malloc(sizeof(fast_stopwatch_state_t));
|
||||
memset(*context_ptr, 0, sizeof(fast_stopwatch_state_t));
|
||||
fast_stopwatch_state_t *state = (fast_stopwatch_state_t *)*context_ptr;
|
||||
_ticks = _lap_ticks = _blink_ticks = _old_minutes = _old_seconds = _hours = 0;
|
||||
_is_running = _colon = false;
|
||||
state->light_on_button = true;
|
||||
@ -225,7 +225,7 @@ void stock_stopwatch_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
}
|
||||
}
|
||||
|
||||
void stock_stopwatch_face_activate(void *context) {
|
||||
void fast_stopwatch_face_activate(void *context) {
|
||||
(void) context;
|
||||
if (_is_running) {
|
||||
// The background task will keep the watch from entering low energy mode while the stopwatch is on screen.
|
||||
@ -233,8 +233,8 @@ void stock_stopwatch_face_activate(void *context) {
|
||||
}
|
||||
}
|
||||
|
||||
bool stock_stopwatch_face_loop(movement_event_t event, void *context) {
|
||||
stock_stopwatch_state_t *state = (stock_stopwatch_state_t *)context;
|
||||
bool fast_stopwatch_face_loop(movement_event_t event, void *context) {
|
||||
fast_stopwatch_state_t *state = (fast_stopwatch_state_t *)context;
|
||||
|
||||
// handle overflow of fast ticks
|
||||
while (_ticks >= (128 * 60 * 60)) {
|
||||
@ -321,7 +321,7 @@ bool stock_stopwatch_face_loop(movement_event_t event, void *context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void stock_stopwatch_face_resign(void *context) {
|
||||
void fast_stopwatch_face_resign(void *context) {
|
||||
(void) context;
|
||||
// cancel the keepalive task
|
||||
movement_cancel_background_task();
|
||||
@ -22,8 +22,8 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef STOCK_STOPWATCH_FACE_H_
|
||||
#define STOCK_STOPWATCH_FACE_H_
|
||||
#ifndef FAST_STOPWATCH_FACE_H_
|
||||
#define FAST_STOPWATCH_FACE_H_
|
||||
|
||||
/*
|
||||
* STOCK STOPWATCH face
|
||||
@ -45,7 +45,7 @@
|
||||
* It either turns on with each button press or remains off.
|
||||
*
|
||||
* NOTE:
|
||||
* This watch face relies heavily on static vars in stock_stopwatch.c.
|
||||
* This watch face relies heavily on static vars in fast_stopwatch.c.
|
||||
* The disadvantage is that you cannot use more than one instance of this
|
||||
* watch face on your custom firmware - but then again, who would want that?
|
||||
* The advantage is that accessing vars is more direct and faster, and we
|
||||
@ -56,12 +56,12 @@
|
||||
|
||||
typedef struct {
|
||||
bool light_on_button; // determines whether the light button actually triggers the led
|
||||
} stock_stopwatch_state_t;
|
||||
} fast_stopwatch_state_t;
|
||||
|
||||
void stock_stopwatch_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void stock_stopwatch_face_activate(void *context);
|
||||
bool stock_stopwatch_face_loop(movement_event_t event, void *context);
|
||||
void stock_stopwatch_face_resign(void *context);
|
||||
void fast_stopwatch_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void fast_stopwatch_face_activate(void *context);
|
||||
bool fast_stopwatch_face_loop(movement_event_t event, void *context);
|
||||
void fast_stopwatch_face_resign(void *context);
|
||||
|
||||
#if __EMSCRIPTEN__
|
||||
void em_cb_handler(void *userData);
|
||||
@ -69,12 +69,12 @@ void em_cb_handler(void *userData);
|
||||
void TC2_Handler(void);
|
||||
#endif
|
||||
|
||||
#define stock_stopwatch_face ((const watch_face_t){ \
|
||||
stock_stopwatch_face_setup, \
|
||||
stock_stopwatch_face_activate, \
|
||||
stock_stopwatch_face_loop, \
|
||||
stock_stopwatch_face_resign, \
|
||||
#define fast_stopwatch_face ((const watch_face_t){ \
|
||||
fast_stopwatch_face_setup, \
|
||||
fast_stopwatch_face_activate, \
|
||||
fast_stopwatch_face_loop, \
|
||||
fast_stopwatch_face_resign, \
|
||||
NULL, \
|
||||
})
|
||||
|
||||
#endif // STOCK_STOPWATCH_FACE_H_
|
||||
#endif // FAST_STOPWATCH_FACE_H_
|
||||
Loading…
x
Reference in New Issue
Block a user