rename types to be more c-like
This commit is contained in:
@@ -2,13 +2,13 @@
|
||||
#include "simple_clock_face.h"
|
||||
#include "watch.h"
|
||||
|
||||
void simple_clock_face_setup(LauncherSettings *settings, void ** context_ptr) {
|
||||
void simple_clock_face_setup(movement_settings_t *settings, void ** context_ptr) {
|
||||
(void) settings;
|
||||
// the only context we need is the timestamp of the previous tick.
|
||||
if (*context_ptr == NULL) *context_ptr = malloc(sizeof(uint32_t));
|
||||
}
|
||||
|
||||
void simple_clock_face_activate(LauncherSettings *settings, void *context) {
|
||||
void simple_clock_face_activate(movement_settings_t *settings, void *context) {
|
||||
if (settings->bit.clock_mode_24h) {
|
||||
watch_set_indicator(WATCH_INDICATOR_24H);
|
||||
}
|
||||
@@ -17,7 +17,7 @@ void simple_clock_face_activate(LauncherSettings *settings, void *context) {
|
||||
*((uint32_t *)context) = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
bool simple_clock_face_loop(LauncherEvent event, LauncherSettings *settings, void *context) {
|
||||
bool simple_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
printf("simple_clock_face_loop\n");
|
||||
const char weekdays[7][3] = {"SA", "SU", "MO", "TU", "WE", "TH", "FR"};
|
||||
char buf[11];
|
||||
@@ -77,7 +77,7 @@ bool simple_clock_face_loop(LauncherEvent event, LauncherSettings *settings, voi
|
||||
return true;
|
||||
}
|
||||
|
||||
void simple_clock_face_resign(LauncherSettings *settings, void *context) {
|
||||
void simple_clock_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
(void) context;
|
||||
}
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#include "movement.h"
|
||||
|
||||
void simple_clock_face_setup(LauncherSettings *settings, void ** context_ptr);
|
||||
void simple_clock_face_activate(LauncherSettings *settings, void *context);
|
||||
bool simple_clock_face_loop(LauncherEvent event, LauncherSettings *settings, void *context);
|
||||
void simple_clock_face_resign(LauncherSettings *settings, void *context);
|
||||
void simple_clock_face_setup(movement_settings_t *settings, void ** context_ptr);
|
||||
void simple_clock_face_activate(movement_settings_t *settings, void *context);
|
||||
bool simple_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
|
||||
void simple_clock_face_resign(movement_settings_t *settings, void *context);
|
||||
|
||||
uint8_t simple_clock_face_get_weekday(uint16_t day, uint16_t month, uint16_t year);
|
||||
|
||||
|
||||
@@ -6,17 +6,17 @@
|
||||
#define PULSOMETER_FACE_FREQUENCY_FACTOR (4ul) // refresh rate will be 2 to this power Hz (0 for 1 Hz, 2 for 4 Hz, etc.)
|
||||
#define PULSOMETER_FACE_FREQUENCY (1 << PULSOMETER_FACE_FREQUENCY_FACTOR)
|
||||
|
||||
void pulseometer_face_setup(LauncherSettings *settings, void ** context_ptr) {
|
||||
void pulseometer_face_setup(movement_settings_t *settings, void ** context_ptr) {
|
||||
(void) settings;
|
||||
if (*context_ptr == NULL) *context_ptr = malloc(sizeof(PulsometerState));
|
||||
}
|
||||
|
||||
void pulseometer_face_activate(LauncherSettings *settings, void *context) {
|
||||
void pulseometer_face_activate(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
memset(context, 0, sizeof(PulsometerState));
|
||||
}
|
||||
|
||||
bool pulseometer_face_loop(LauncherEvent event, LauncherSettings *settings, void *context) {
|
||||
bool pulseometer_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
printf("pulseometer_face_loop\n");
|
||||
(void) settings;
|
||||
PulsometerState *pulsometer_state = (PulsometerState *)context;
|
||||
@@ -81,7 +81,7 @@ bool pulseometer_face_loop(LauncherEvent event, LauncherSettings *settings, void
|
||||
return true;
|
||||
}
|
||||
|
||||
void pulseometer_face_resign(LauncherSettings *settings, void *context) {
|
||||
void pulseometer_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
(void) context;
|
||||
}
|
||||
|
||||
@@ -9,10 +9,10 @@ typedef struct {
|
||||
int16_t ticks;
|
||||
} PulsometerState;
|
||||
|
||||
void pulseometer_face_setup(LauncherSettings *settings, void ** context_ptr);
|
||||
void pulseometer_face_activate(LauncherSettings *settings, void *context);
|
||||
bool pulseometer_face_loop(LauncherEvent event, LauncherSettings *settings, void *context);
|
||||
void pulseometer_face_resign(LauncherSettings *settings, void *context);
|
||||
void pulseometer_face_setup(movement_settings_t *settings, void ** context_ptr);
|
||||
void pulseometer_face_activate(movement_settings_t *settings, void *context);
|
||||
bool pulseometer_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
|
||||
void pulseometer_face_resign(movement_settings_t *settings, void *context);
|
||||
|
||||
#define pulseometer_face { \
|
||||
pulseometer_face_setup, \
|
||||
|
||||
@@ -5,18 +5,18 @@
|
||||
#define PREFERENCES_FACE_NUM_PREFEFENCES (5)
|
||||
const char preferences_face_titles[PREFERENCES_FACE_NUM_PREFEFENCES][11] = {"CL ", "Bt Beep ", "SC ", "Lt grn ", "Lt red "};
|
||||
|
||||
void preferences_face_setup(LauncherSettings *settings, void ** context_ptr) {
|
||||
void preferences_face_setup(movement_settings_t *settings, void ** context_ptr) {
|
||||
(void) settings;
|
||||
if (*context_ptr == NULL) *context_ptr = malloc(sizeof(uint8_t));
|
||||
}
|
||||
|
||||
void preferences_face_activate(LauncherSettings *settings, void *context) {
|
||||
void preferences_face_activate(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
*((uint8_t *)context) = 0;
|
||||
movement_request_tick_frequency(4); // we need to manually blink some pixels
|
||||
}
|
||||
|
||||
bool preferences_face_loop(LauncherEvent event, LauncherSettings *settings, void *context) {
|
||||
bool preferences_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
printf("preferences_face_loop\n");
|
||||
uint8_t current_page = *((uint8_t *)context);
|
||||
switch (event.event_type) {
|
||||
@@ -112,7 +112,7 @@ bool preferences_face_loop(LauncherEvent event, LauncherSettings *settings, void
|
||||
return true;
|
||||
}
|
||||
|
||||
void preferences_face_resign(LauncherSettings *settings, void *context) {
|
||||
void preferences_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
(void) context;
|
||||
watch_set_led_off();
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#include "movement.h"
|
||||
|
||||
void preferences_face_setup(LauncherSettings *settings, void ** context_ptr);
|
||||
void preferences_face_activate(LauncherSettings *settings, void *context);
|
||||
bool preferences_face_loop(LauncherEvent event, LauncherSettings *settings, void *context);
|
||||
void preferences_face_resign(LauncherSettings *settings, void *context);
|
||||
void preferences_face_setup(movement_settings_t *settings, void ** context_ptr);
|
||||
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);
|
||||
|
||||
#define preferences_face { \
|
||||
preferences_face_setup, \
|
||||
|
||||
@@ -5,18 +5,18 @@
|
||||
#define SET_TIME_FACE_NUM_SETTINGS (6)
|
||||
const char set_time_face_titles[SET_TIME_FACE_NUM_SETTINGS][3] = {"HR", "MN", "SE", "YR", "MO", "DA"};
|
||||
|
||||
void set_time_face_setup(LauncherSettings *settings, void ** context_ptr) {
|
||||
void set_time_face_setup(movement_settings_t *settings, void ** context_ptr) {
|
||||
(void) settings;
|
||||
if (*context_ptr == NULL) *context_ptr = malloc(sizeof(uint8_t));
|
||||
}
|
||||
|
||||
void set_time_face_activate(LauncherSettings *settings, void *context) {
|
||||
void set_time_face_activate(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
*((uint8_t *)context) = 0;
|
||||
movement_request_tick_frequency(4);
|
||||
}
|
||||
|
||||
bool set_time_face_loop(LauncherEvent event, LauncherSettings *settings, void *context) {
|
||||
bool set_time_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
uint8_t current_page = *((uint8_t *)context);
|
||||
const uint8_t days_in_month[12] = {31, 28, 31, 30, 31, 30, 30, 31, 30, 31, 30, 31};
|
||||
watch_date_time date_time = watch_rtc_get_date_time();
|
||||
@@ -101,7 +101,7 @@ bool set_time_face_loop(LauncherEvent event, LauncherSettings *settings, void *c
|
||||
return true;
|
||||
}
|
||||
|
||||
void set_time_face_resign(LauncherSettings *settings, void *context) {
|
||||
void set_time_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
(void) context;
|
||||
watch_set_led_off();
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
|
||||
#include "movement.h"
|
||||
|
||||
void set_time_face_setup(LauncherSettings *settings, void ** context_ptr);
|
||||
void set_time_face_activate(LauncherSettings *settings, void *context);
|
||||
bool set_time_face_loop(LauncherEvent event, LauncherSettings *settings, void *context);
|
||||
void set_time_face_resign(LauncherSettings *settings, void *context);
|
||||
void set_time_face_setup(movement_settings_t *settings, void ** context_ptr);
|
||||
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);
|
||||
|
||||
#define set_time_face { \
|
||||
set_time_face_setup, \
|
||||
|
||||
Reference in New Issue
Block a user