fix missing prototype warnings

This commit is contained in:
Joey Castillo
2021-12-05 23:49:26 -06:00
parent 316e1f292c
commit 762af872d2
46 changed files with 242 additions and 234 deletions

View File

@@ -38,7 +38,7 @@ uint32_t rol32(uint32_t number, uint8_t bits) {
return ((number << bits) | (uint32_t)(number >> (32-bits)));
}
void hashBlock() {
void hashBlock(void) {
uint8_t i;
uint32_t a,b,c,d,e,t;
@@ -97,7 +97,7 @@ void writeArray(uint8_t *buffer, uint8_t size){
}
}
void pad() {
void pad(void) {
// Implement SHA-1 padding (fips180-2 <20><>5.1.1)
// Pad with 0x80 followed by 0x00 until the end of the block

View File

@@ -58,27 +58,27 @@ const int16_t movement_timezone_offsets[] = {
const char movement_valid_position_0_chars[] = " AaBbCcDdEeFGgHhIiJKLMNnOoPQrSTtUuWXYZ-='+\\/0123456789";
const char movement_valid_position_1_chars[] = " ABCDEFHlJLNORTtUX-='01378";
void cb_mode_btn_interrupt();
void cb_light_btn_interrupt();
void cb_alarm_btn_interrupt();
void cb_alarm_btn_extwake();
void cb_alarm_fired();
void cb_fast_tick();
void cb_tick();
void cb_mode_btn_interrupt(void);
void cb_light_btn_interrupt(void);
void cb_alarm_btn_interrupt(void);
void cb_alarm_btn_extwake(void);
void cb_alarm_fired(void);
void cb_fast_tick(void);
void cb_tick(void);
static inline void _movement_reset_inactivity_countdown() {
static inline void _movement_reset_inactivity_countdown(void) {
movement_state.le_mode_ticks = movement_le_inactivity_deadlines[movement_state.settings.bit.le_interval];
movement_state.timeout_ticks = movement_timeout_inactivity_deadlines[movement_state.settings.bit.to_interval];
}
static inline void _movement_enable_fast_tick_if_needed() {
static inline void _movement_enable_fast_tick_if_needed(void) {
if (!movement_state.fast_tick_enabled) {
movement_state.fast_ticks = 0;
watch_rtc_register_periodic_callback(cb_fast_tick, 128);
}
}
static inline void _movement_disable_fast_tick_if_possible() {
static inline void _movement_disable_fast_tick_if_possible(void) {
if ((movement_state.light_ticks == -1) &&
(movement_state.alarm_ticks == -1) &&
((movement_state.light_down_timestamp + movement_state.mode_down_timestamp + movement_state.alarm_down_timestamp) == 0)) {
@@ -87,7 +87,7 @@ static inline void _movement_disable_fast_tick_if_possible() {
}
}
void _movement_handle_background_tasks() {
static void _movement_handle_background_tasks(void) {
for(uint8_t i = 0; i < MOVEMENT_NUM_FACES; i++) {
// For each face, if the watch face wants a background task...
if (watch_faces[i].wants_background_task != NULL && watch_faces[i].wants_background_task(&movement_state.settings, watch_face_contexts[i])) {
@@ -107,7 +107,7 @@ void movement_request_tick_frequency(uint8_t freq) {
if (freq) watch_rtc_register_periodic_callback(cb_tick, freq);
}
void movement_illuminate_led() {
void movement_illuminate_led(void) {
if (movement_state.settings.bit.led_duration) {
watch_set_led_color(movement_state.settings.bit.led_red_color ? (0xF | movement_state.settings.bit.led_red_color << 4) : 0,
movement_state.settings.bit.led_green_color ? (0xF | movement_state.settings.bit.led_green_color << 4) : 0);
@@ -121,22 +121,22 @@ void movement_move_to_face(uint8_t watch_face_index) {
movement_state.next_watch_face = watch_face_index;
}
void movement_move_to_next_face() {
void movement_move_to_next_face(void) {
movement_move_to_face((movement_state.current_watch_face + 1) % MOVEMENT_NUM_FACES);
}
void movement_play_signal() {
void movement_play_signal(void) {
watch_buzzer_play_note(BUZZER_NOTE_C8, 75);
watch_buzzer_play_note(BUZZER_NOTE_REST, 100);
watch_buzzer_play_note(BUZZER_NOTE_C8, 100);
}
void movement_play_alarm() {
void movement_play_alarm(void) {
movement_state.alarm_ticks = 128 * 5 - 80; // 80 ticks short of 5 seconds, or 4.375 seconds (our beep is 0.375 seconds)
_movement_enable_fast_tick_if_needed();
}
void app_init() {
void app_init(void) {
memset(&movement_state, 0, sizeof(movement_state));
movement_state.settings.bit.led_green_color = 0xF;
@@ -149,11 +149,11 @@ void app_init() {
_movement_reset_inactivity_countdown();
}
void app_wake_from_backup() {
void app_wake_from_backup(void) {
movement_state.settings.reg = watch_get_backup_data(0);
}
void app_setup() {
void app_setup(void) {
watch_store_backup_data(movement_state.settings.reg, 0);
static bool is_first_launch = true;
@@ -194,13 +194,13 @@ void app_setup() {
}
}
void app_prepare_for_standby() {
void app_prepare_for_standby(void) {
}
void app_wake_from_standby() {
void app_wake_from_standby(void) {
}
bool app_loop() {
bool app_loop(void) {
if (movement_state.watch_face_changed) {
if (movement_state.settings.bit.button_should_sound) {
// low note for nonzero case, high note for return to watch_face 0
@@ -300,7 +300,7 @@ bool app_loop() {
return can_sleep && (movement_state.light_ticks == -1) && !movement_state.is_buzzing;
}
movement_event_type_t _figure_out_button_event(bool pin_level, movement_event_type_t button_down_event_type, uint8_t *down_timestamp) {
static movement_event_type_t _figure_out_button_event(bool pin_level, movement_event_type_t button_down_event_type, uint8_t *down_timestamp) {
// force alarm off if the user pressed a button.
if (movement_state.alarm_ticks) movement_state.alarm_ticks = 0;
@@ -323,34 +323,34 @@ movement_event_type_t _figure_out_button_event(bool pin_level, movement_event_ty
}
}
void cb_light_btn_interrupt() {
void cb_light_btn_interrupt(void) {
bool pin_level = watch_get_pin_level(BTN_LIGHT);
_movement_reset_inactivity_countdown();
event.event_type = _figure_out_button_event(pin_level, EVENT_LIGHT_BUTTON_DOWN, &movement_state.light_down_timestamp);
}
void cb_mode_btn_interrupt() {
void cb_mode_btn_interrupt(void) {
bool pin_level = watch_get_pin_level(BTN_MODE);
_movement_reset_inactivity_countdown();
event.event_type = _figure_out_button_event(pin_level, EVENT_MODE_BUTTON_DOWN, &movement_state.mode_down_timestamp);
}
void cb_alarm_btn_interrupt() {
void cb_alarm_btn_interrupt(void) {
bool pin_level = watch_get_pin_level(BTN_ALARM);
_movement_reset_inactivity_countdown();
event.event_type = _figure_out_button_event(pin_level, EVENT_ALARM_BUTTON_DOWN, &movement_state.alarm_down_timestamp);
}
void cb_alarm_btn_extwake() {
void cb_alarm_btn_extwake(void) {
// wake up!
_movement_reset_inactivity_countdown();
}
void cb_alarm_fired() {
void cb_alarm_fired(void) {
movement_state.needs_background_tasks_handled = true;
}
void cb_fast_tick() {
void cb_fast_tick(void) {
movement_state.fast_ticks++;
if (movement_state.light_ticks > 0) movement_state.light_ticks--;
if (movement_state.alarm_ticks > 0) movement_state.alarm_ticks--;
@@ -359,7 +359,7 @@ void cb_fast_tick() {
if (movement_state.fast_ticks >= 1280) watch_rtc_disable_periodic_callback(128);
}
void cb_tick() {
void cb_tick(void) {
event.event_type = EVENT_TICK;
watch_date_time date_time = watch_rtc_get_date_time();
if (date_time.unit.second != movement_state.last_second) {

View File

@@ -242,11 +242,11 @@ typedef struct {
} movement_state_t;
void movement_move_to_face(uint8_t watch_face_index);
void movement_move_to_next_face();
void movement_illuminate_led();
void movement_move_to_next_face(void);
void movement_illuminate_led(void);
void movement_request_tick_frequency(uint8_t freq);
void movement_play_signal();
void movement_play_alarm();
void movement_play_signal(void);
void movement_play_alarm(void);
#endif // MOVEMENT_H_

View File

@@ -26,7 +26,7 @@ void world_clock_face_activate(movement_settings_t *settings, void *context) {
watch_set_colon();
}
bool world_clock_face_do_display_mode(movement_event_t event, movement_settings_t *settings, world_clock_state_t *state) {
static bool world_clock_face_do_display_mode(movement_event_t event, movement_settings_t *settings, world_clock_state_t *state) {
char buf[11];
uint8_t pos;
@@ -101,7 +101,7 @@ bool world_clock_face_do_display_mode(movement_event_t event, movement_settings_
return true;
}
bool world_clock_face_do_settings_mode(movement_event_t event, movement_settings_t *settings, world_clock_state_t *state) {
static bool _world_clock_face_do_settings_mode(movement_event_t event, movement_settings_t *settings, world_clock_state_t *state) {
switch (event.event_type) {
case EVENT_MODE_BUTTON_UP:
movement_move_to_next_face();
@@ -176,7 +176,7 @@ bool world_clock_face_loop(movement_event_t event, movement_settings_t *settings
if (state->current_screen == 0) {
return world_clock_face_do_display_mode(event, settings, state);
} else {
return world_clock_face_do_settings_mode(event, settings, state);
return _world_clock_face_do_settings_mode(event, settings, state);
}
}

View File

@@ -3,12 +3,12 @@
#include "day_one_face.h"
#include "watch.h"
uint32_t _day_one_face_juliandaynum(uint16_t year, uint16_t month, uint16_t day) {
static uint32_t _day_one_face_juliandaynum(uint16_t year, uint16_t month, uint16_t day) {
// from here: https://en.wikipedia.org/wiki/Julian_day#Julian_day_number_calculation
return (1461 * (year + 4800 + (month - 14) / 12)) / 4 + (367 * (month - 2 - 12 * ((month - 14) / 12))) / 12 - (3 * ((year + 4900 + (month - 14) / 12) / 100))/4 + day - 32075;
}
void _day_one_face_update(day_one_state_t state) {
static void _day_one_face_update(day_one_state_t state) {
char buf[14];
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);

View File

@@ -12,7 +12,7 @@
// 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)
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, watch_date_time date_time) {
char buf[14];
char time_indication_character;
int8_t pos;
@@ -66,7 +66,7 @@ void _lis2dh_logging_face_update_display(movement_settings_t *settings, lis2dh_l
watch_display_string(buf, 0);
}
void _lis2dh_logging_face_log_data(lis2dh_logger_state_t *logger_state) {
static void _lis2dh_logging_face_log_data(lis2dh_logger_state_t *logger_state) {
watch_date_time date_time = watch_rtc_get_date_time();
// we get this call 15 minutes late; i.e. at 6:15 we're logging events for 6:00.
// so: if we're at the top of the hour, roll the hour back too (7:00 task logs data for 6:45)

View File

@@ -3,7 +3,7 @@
#include "voltage_face.h"
#include "watch.h"
void _voltage_face_update_display() {
static void _voltage_face_update_display(void) {
char buf[14];
float voltage = (float)watch_get_vcc_voltage() / 1000.0;
sprintf(buf, "BA %4.2f V", voltage);

View File

@@ -2,7 +2,7 @@
#include "watch.h"
#include "watch_utility.h"
void thermistor_driver_enable() {
void thermistor_driver_enable(void) {
// Enable the ADC peripheral, which we'll use to read the thermistor value.
watch_enable_adc();
// Enable analog circuitry on the sense pin, which is tied to the thermistor resistor divider.
@@ -13,7 +13,7 @@ void thermistor_driver_enable() {
watch_set_pin_level(THERMISTOR_ENABLE_PIN, !THERMISTOR_ENABLE_VALUE);
}
void thermistor_driver_disable() {
void thermistor_driver_disable(void) {
// Disable the ADC peripheral.
watch_disable_adc();
// Disable analog circuitry on the sense pin to save power.
@@ -22,7 +22,7 @@ void thermistor_driver_disable() {
watch_disable_digital_output(THERMISTOR_ENABLE_PIN);
}
float thermistor_driver_get_temperature() {
float thermistor_driver_get_temperature(void) {
// set the enable pin to the level that powers the thermistor circuit.
watch_set_pin_level(THERMISTOR_ENABLE_PIN, THERMISTOR_ENABLE_VALUE);
// get the sense pin level

View File

@@ -12,8 +12,8 @@
#define THERMISTOR_NOMINAL_RESISTANCE (10000.0)
#define THERMISTOR_SERIES_RESISTANCE (10000.0)
void thermistor_driver_enable();
void thermistor_driver_disable();
float thermistor_driver_get_temperature();
void thermistor_driver_enable(void);
void thermistor_driver_disable(void);
float thermistor_driver_get_temperature(void);
#endif // THERMISTOR_DRIVER_H_

View File

@@ -4,7 +4,7 @@
#include "thermistor_driver.h"
#include "watch.h"
void _thermistor_logging_face_log_data(thermistor_logger_state_t *logger_state) {
static void _thermistor_logging_face_log_data(thermistor_logger_state_t *logger_state) {
thermistor_driver_enable();
watch_date_time date_time = watch_rtc_get_date_time();
size_t pos = logger_state->data_points % THERMISTOR_LOGGING_NUM_DATA_POINTS;
@@ -16,7 +16,7 @@ void _thermistor_logging_face_log_data(thermistor_logger_state_t *logger_state)
thermistor_driver_disable();
}
void _thermistor_logging_face_update_display(thermistor_logger_state_t *logger_state, bool in_fahrenheit, bool clock_mode_24h) {
static void _thermistor_logging_face_update_display(thermistor_logger_state_t *logger_state, bool in_fahrenheit, bool clock_mode_24h) {
int8_t pos = (logger_state->data_points - 1 - logger_state->display_index) % THERMISTOR_LOGGING_NUM_DATA_POINTS;
char buf[14];

View File

@@ -4,7 +4,7 @@
#include "thermistor_driver.h"
#include "watch.h"
void _thermistor_readout_face_update_display(bool in_fahrenheit) {
static void _thermistor_readout_face_update_display(bool in_fahrenheit) {
thermistor_driver_enable();
float temperature_c = thermistor_driver_get_temperature();
char buf[14];