diff options
author | Joey Castillo <joeycastillo@utexas.edu> | 2021-12-05 23:49:26 -0600 |
---|---|---|
committer | Joey Castillo <joeycastillo@utexas.edu> | 2021-12-10 12:00:26 -0500 |
commit | 762af872d2f2c977e51d6e51b8c3ad622485cc05 (patch) | |
tree | 0fd44fe4996b04a82c5c0cc46178b5893d3ae1c0 /apps | |
parent | 316e1f292c603885f2af3dcd69ce797d64776425 (diff) | |
download | Sensor-Watch-762af872d2f2c977e51d6e51b8c3ad622485cc05.tar.gz Sensor-Watch-762af872d2f2c977e51d6e51b8c3ad622485cc05.tar.bz2 Sensor-Watch-762af872d2f2c977e51d6e51b8c3ad622485cc05.zip |
fix missing prototype warnings
Diffstat (limited to 'apps')
-rw-r--r-- | apps/accelerometer-test/app.c | 22 | ||||
-rw-r--r-- | apps/beats-time/app.c | 54 | ||||
-rw-r--r-- | apps/buzzer-test/app.c | 14 | ||||
-rw-r--r-- | apps/spi-test/app.c | 12 | ||||
-rw-r--r-- | apps/starter-project/app.c | 24 |
5 files changed, 63 insertions, 63 deletions
diff --git a/apps/accelerometer-test/app.c b/apps/accelerometer-test/app.c index bea00f6f..8bd6537e 100644 --- a/apps/accelerometer-test/app.c +++ b/apps/accelerometer-test/app.c @@ -11,13 +11,13 @@ // Also note that this board has its INT1 pin wired to A1, which is not an external // wake pin. Future accelerometer boards will wire interrupt pins to A2 and A4. -void cb_light_pressed() { +void cb_light_pressed(void) { } -void cb_mode_pressed() { +void cb_mode_pressed(void) { } -void cb_alarm_pressed() { +void cb_alarm_pressed(void) { } uint8_t interrupts = 0; @@ -25,11 +25,11 @@ uint8_t last_interrupts = 0; uint8_t ticks = 0; char buf[13] = {0}; -void cb_interrupt_1() { +void cb_interrupt_1(void) { interrupts++; } -void cb_tick() { +void cb_tick(void) { if (++ticks == 30) { last_interrupts = interrupts; interrupts = 0; @@ -37,7 +37,7 @@ void cb_tick() { } } -void app_init() { +void app_init(void) { gpio_set_pin_direction(A0, GPIO_DIRECTION_OUT); gpio_set_pin_function(A0, GPIO_PIN_FUNCTION_OFF); gpio_set_pin_level(A0, true); @@ -64,19 +64,19 @@ void app_init() { watch_rtc_register_tick_callback(cb_tick); } -void app_wake_from_backup() { +void app_wake_from_backup(void) { } -void app_setup() { +void app_setup(void) { } -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) { sprintf(buf, "IN%2d%3d%3d", ticks, interrupts, last_interrupts); watch_display_string(buf, 0); diff --git a/apps/beats-time/app.c b/apps/beats-time/app.c index 5c68a3e8..3a8c2dac 100644 --- a/apps/beats-time/app.c +++ b/apps/beats-time/app.c @@ -26,19 +26,19 @@ typedef struct ApplicationState { uint8_t subsecond; // a value from 0 to (BEAT_REFRESH_FREQUENCY - 1) indicating the fractional second } ApplicationState; -void do_clock_mode(); -void do_beats_mode(); -void do_set_time_mode(); -void set_time_mode_handle_primary_button(); -void set_time_mode_handle_secondary_button(); +void do_clock_mode(void); +void do_beats_mode(void); +void do_set_time_mode(void); +void set_time_mode_handle_primary_button(void); +void set_time_mode_handle_secondary_button(void); float clock2beats(uint16_t, uint16_t, uint16_t, int16_t); -void cb_light_pressed(); -void cb_mode_pressed(); -void cb_alarm_pressed(); -void cb_tick(); -void cb_fast_tick(); +void cb_light_pressed(void); +void cb_mode_pressed(void); +void cb_alarm_pressed(void); +void cb_tick(void); +void cb_fast_tick(void); ApplicationState application_state; char buf[16] = {0}; @@ -46,15 +46,15 @@ char buf[16] = {0}; /** * @brief Zeroes out the application state struct. */ -void app_init() { +void app_init(void) { memset(&application_state, 0, sizeof(application_state)); } -void app_wake_from_backup() { +void app_wake_from_backup(void) { // This app does not support BACKUP mode. } -void app_setup() { +void app_setup(void) { watch_enable_external_interrupts(); watch_register_interrupt_callback(BTN_MODE, cb_mode_pressed, INTERRUPT_TRIGGER_RISING); watch_register_interrupt_callback(BTN_LIGHT, cb_light_pressed, INTERRUPT_TRIGGER_RISING); @@ -67,13 +67,13 @@ void app_setup() { watch_rtc_register_tick_callback(cb_tick); } -void app_prepare_for_standby() { +void app_prepare_for_standby(void) { } -void app_wake_from_standby() { +void app_wake_from_standby(void) { } -void update_tick_frequency() { +static void update_tick_frequency(void) { watch_rtc_disable_all_periodic_callbacks(); if (application_state.mode == MODE_BEATS) { watch_rtc_register_periodic_callback(cb_fast_tick, BEAT_REFRESH_FREQUENCY); @@ -82,7 +82,7 @@ void update_tick_frequency() { } } -bool app_loop() { +bool app_loop(void) { // play a beep if the mode has changed in response to a user's press of the MODE button if (application_state.mode_changed) { // low note for nonzero case, high note for return to clock @@ -135,7 +135,7 @@ bool app_loop() { return true; } -void do_clock_mode() { +void do_clock_mode(void) { watch_date_time date_time = watch_rtc_get_date_time(); const char months[12][3] = {"JA", "FE", "MR", "AR", "MA", "JN", "JL", "AU", "SE", "OC", "NO", "dE"}; @@ -146,7 +146,7 @@ void do_clock_mode() { } -void do_beats_mode() { +void do_beats_mode(void) { watch_clear_colon(); watch_date_time date_time = watch_rtc_get_date_time(); @@ -168,7 +168,7 @@ float clock2beats(uint16_t hours, uint16_t minutes, uint16_t seconds, int16_t ut return beats; } -void do_set_time_mode() { +void do_set_time_mode(void) { watch_date_time date_time = watch_rtc_get_date_time(); watch_display_string(" ", 0); @@ -196,12 +196,12 @@ void do_set_time_mode() { watch_set_pixel(1, 12); // required for T in position 1 } -void set_time_mode_handle_primary_button() { +void set_time_mode_handle_primary_button(void) { application_state.page++; if (application_state.page == 6) application_state.page = 0; } -void set_time_mode_handle_secondary_button() { +void set_time_mode_handle_secondary_button(void) { watch_date_time date_time = watch_rtc_get_date_time(); const uint8_t days_in_month[12] = {31, 28, 31, 30, 31, 30, 30, 31, 30, 31, 30, 31}; @@ -234,14 +234,14 @@ void set_time_mode_handle_secondary_button() { watch_rtc_set_date_time(date_time); } -void cb_mode_pressed() { +void cb_mode_pressed(void) { application_state.mode = (application_state.mode + 1) % NUM_MODES; application_state.mode_changed = true; application_state.mode_ticks = 300; application_state.page = 0; } -void cb_light_pressed() { +void cb_light_pressed(void) { switch (application_state.mode) { case MODE_SET: set_time_mode_handle_secondary_button(); @@ -252,7 +252,7 @@ void cb_light_pressed() { } } -void cb_alarm_pressed() { +void cb_alarm_pressed(void) { switch (application_state.mode) { case MODE_SET: set_time_mode_handle_primary_button(); @@ -262,7 +262,7 @@ void cb_alarm_pressed() { } } -void cb_tick() { +void cb_tick(void) { if (application_state.light_ticks > 0) { application_state.light_ticks--; } @@ -271,7 +271,7 @@ void cb_tick() { } } -void cb_fast_tick() { +void cb_fast_tick(void) { watch_date_time date_time = watch_rtc_get_date_time(); if (date_time.unit.second != application_state.last_second) { application_state.last_second = date_time.unit.second; diff --git a/apps/buzzer-test/app.c b/apps/buzzer-test/app.c index 58158dff..65d2356c 100644 --- a/apps/buzzer-test/app.c +++ b/apps/buzzer-test/app.c @@ -9,18 +9,18 @@ typedef struct ApplicationState { ApplicationState application_state; -void cb_alarm_pressed() { +void cb_alarm_pressed(void) { application_state.play = true; } -void app_init() { +void app_init(void) { memset(&application_state, 0, sizeof(application_state)); } -void app_wake_from_backup() { +void app_wake_from_backup(void) { } -void app_setup() { +void app_setup(void) { watch_register_extwake_callback(BTN_ALARM, cb_alarm_pressed, true); watch_enable_display(); @@ -28,14 +28,14 @@ void app_setup() { watch_enable_buzzer(); } -void app_prepare_for_standby() { +void app_prepare_for_standby(void) { watch_display_string(" rains ", 2); } -void app_wake_from_standby() { +void app_wake_from_standby(void) { } -bool app_loop() { +bool app_loop(void) { if (application_state.play) { printf("Playing song...\n"); const BuzzerNote rains[] = { diff --git a/apps/spi-test/app.c b/apps/spi-test/app.c index 3fba9386..6ddd2782 100644 --- a/apps/spi-test/app.c +++ b/apps/spi-test/app.c @@ -10,7 +10,7 @@ struct io_descriptor *io; struct spi_m_sync_descriptor SPI_0; -void app_init() { +void app_init(void) { // SPI_0_CLOCK_init hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM3_GCLK_ID_CORE, CONF_GCLK_SERCOM3_CORE_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); hri_gclk_write_PCHCTRL_reg(GCLK, SERCOM3_GCLK_ID_SLOW, CONF_GCLK_SERCOM3_SLOW_SRC | (1 << GCLK_PCHCTRL_CHEN_Pos)); @@ -39,21 +39,21 @@ void app_init() { spi_m_sync_enable(&SPI_0); } -void app_wake_from_backup() { +void app_wake_from_backup(void) { } -void app_setup() { +void app_setup(void) { } -void app_prepare_for_standby() { +void app_prepare_for_standby(void) { } -void app_wake_from_standby() { +void app_wake_from_standby(void) { } static uint8_t get_id_command[4] = {0x9F}; -bool app_loop() { +bool app_loop(void) { watch_set_pin_level(A3, false); io_write(io, get_id_command, 1); uint8_t buf[3] = {0}; diff --git a/apps/starter-project/app.c b/apps/starter-project/app.c index fa887bae..9a4ef4fe 100644 --- a/apps/starter-project/app.c +++ b/apps/starter-project/app.c @@ -31,9 +31,9 @@ ApplicationState application_state; ////////////////////////////////////////////////////////////////////////////////////////// // This section defines the callbacks for our button press events (implemented at bottom). // Add any other callbacks you may need either here or in another file. -void cb_light_pressed(); -void cb_mode_pressed(); -void cb_alarm_pressed(); +void cb_light_pressed(void); +void cb_mode_pressed(void); +void cb_alarm_pressed(void); ////////////////////////////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ void cb_alarm_pressed(); * @brief the app_init function is called before anything else. Use it to set up any * internal data structures or application state required by your app. */ -void app_init() { +void app_init(void) { memset(&application_state, 0, sizeof(application_state)); } @@ -57,7 +57,7 @@ void app_init() { * * @see watch_enter_deep_sleep() */ -void app_wake_from_backup() { +void app_wake_from_backup(void) { // This app does not support BACKUP mode. } @@ -76,7 +76,7 @@ void app_wake_from_backup() { * also wiped out the system RAM. Note that when this is called after waking from sleep, * the RTC will still be configured with the correct date and time. */ -void app_setup() { +void app_setup(void) { watch_enable_leds(); watch_enable_buzzer(); @@ -101,14 +101,14 @@ void app_setup() { * In STANDBY mode, most peripherals are shut down, and no code will run until the watch receives * an interrupt (generally either the 1Hz tick or a press on one of the buttons). */ -void app_prepare_for_standby() { +void app_prepare_for_standby(void) { } /** * @brief the app_wake_from_standby function is called after the watch wakes from STANDBY mode, * but before your main app_loop. */ -void app_wake_from_standby() { +void app_wake_from_standby(void) { application_state.wake_count++; } @@ -116,7 +116,7 @@ void app_wake_from_standby() { * @brief the app_loop function is called once on app startup and then again each time the * watch exits STANDBY mode. */ -bool app_loop() { +bool app_loop(void) { if (application_state.beep) { watch_buzzer_play_note(BUZZER_NOTE_C7, 50); application_state.beep = false; @@ -178,7 +178,7 @@ bool app_loop() { ////////////////////////////////////////////////////////////////////////////////////////// // Implementations for our callback functions. Replace these with whatever functionality // your app requires. -void cb_light_pressed() { +void cb_light_pressed(void) { // always turn the light off when the pin goes low if (watch_get_pin_level(BTN_LIGHT) == 0) { application_state.light_on = false; @@ -188,11 +188,11 @@ void cb_light_pressed() { application_state.light_on = true; } -void cb_mode_pressed() { +void cb_mode_pressed(void) { application_state.mode = (application_state.mode + 1) % 2; application_state.beep = true; } -void cb_alarm_pressed() { +void cb_alarm_pressed(void) { application_state.enter_sleep_mode = true; } |