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 /watch-library/watch | |
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 'watch-library/watch')
-rw-r--r-- | watch-library/watch/watch.c | 2 | ||||
-rw-r--r-- | watch-library/watch/watch.h | 2 | ||||
-rw-r--r-- | watch-library/watch/watch_adc.c | 10 | ||||
-rw-r--r-- | watch-library/watch/watch_adc.h | 6 | ||||
-rw-r--r-- | watch-library/watch/watch_app.h | 12 | ||||
-rw-r--r-- | watch-library/watch/watch_buzzer.c | 8 | ||||
-rw-r--r-- | watch-library/watch/watch_buzzer.h | 8 | ||||
-rw-r--r-- | watch-library/watch/watch_deepsleep.c | 12 | ||||
-rw-r--r-- | watch-library/watch/watch_deepsleep.h | 8 | ||||
-rw-r--r-- | watch-library/watch/watch_extint.c | 6 | ||||
-rw-r--r-- | watch-library/watch/watch_extint.h | 6 | ||||
-rw-r--r-- | watch-library/watch/watch_i2c.c | 4 | ||||
-rw-r--r-- | watch-library/watch/watch_i2c.h | 4 | ||||
-rw-r--r-- | watch-library/watch/watch_led.c | 12 | ||||
-rw-r--r-- | watch-library/watch/watch_led.h | 12 | ||||
-rw-r--r-- | watch-library/watch/watch_private.c | 10 | ||||
-rw-r--r-- | watch-library/watch/watch_private.h | 17 | ||||
-rw-r--r-- | watch-library/watch/watch_rtc.c | 14 | ||||
-rw-r--r-- | watch-library/watch/watch_rtc.h | 10 | ||||
-rw-r--r-- | watch-library/watch/watch_slcd.c | 20 | ||||
-rw-r--r-- | watch-library/watch/watch_slcd.h | 16 |
21 files changed, 103 insertions, 96 deletions
diff --git a/watch-library/watch/watch.c b/watch-library/watch/watch.c index de7160c5..844ed3d9 100644 --- a/watch-library/watch/watch.c +++ b/watch-library/watch/watch.c @@ -35,6 +35,6 @@ void SYSTEM_Handler(void) { } } -bool watch_is_battery_low() { +bool watch_is_battery_low(void) { return battery_is_low; } diff --git a/watch-library/watch/watch.h b/watch-library/watch/watch.h index fee8f4ea..669a5ed1 100644 --- a/watch-library/watch/watch.h +++ b/watch-library/watch/watch.h @@ -71,6 +71,6 @@ * the battery voltage has fallen to 2.5 volts, it will have probably less than 10% of its capacity remaining, and * you can expect the voltage to drop relatively quickly as the battery dies. */ -bool watch_is_battery_low(); +bool watch_is_battery_low(void); #endif /* WATCH_H_ */
\ No newline at end of file diff --git a/watch-library/watch/watch_adc.c b/watch-library/watch/watch_adc.c index 4aff86e6..5ba7abdf 100644 --- a/watch-library/watch/watch_adc.c +++ b/watch-library/watch/watch_adc.c @@ -24,11 +24,11 @@ #include "watch_adc.h" -void _watch_sync_adc() { +static void _watch_sync_adc(void) { while (ADC->SYNCBUSY.reg); } -uint16_t _watch_get_analog_value(uint16_t channel) { +static uint16_t _watch_get_analog_value(uint16_t channel) { if (ADC->INPUTCTRL.bit.MUXPOS != channel) { ADC->INPUTCTRL.bit.MUXPOS = channel; _watch_sync_adc(); @@ -40,7 +40,7 @@ uint16_t _watch_get_analog_value(uint16_t channel) { return ADC->RESULT.reg; } -void watch_enable_adc() { +void watch_enable_adc(void) { MCLK->APBCMASK.reg |= MCLK_APBCMASK_ADC; GCLK->PCHCTRL[ADC_GCLK_ID].reg = GCLK_PCHCTRL_GEN_GCLK0 | GCLK_PCHCTRL_CHEN; @@ -151,7 +151,7 @@ void watch_set_analog_reference_voltage(watch_adc_reference_voltage reference) { _watch_get_analog_value(ADC_INPUTCTRL_MUXPOS_SCALEDCOREVCC); } -uint16_t watch_get_vcc_voltage() { +uint16_t watch_get_vcc_voltage(void) { // stash the previous reference so we can restore it when we're done. uint8_t oldref = ADC->REFCTRL.bit.REFSEL; @@ -171,7 +171,7 @@ inline void watch_disable_analog_input(const uint8_t pin) { gpio_set_pin_function(pin, GPIO_PIN_FUNCTION_OFF); } -inline void watch_disable_adc() { +inline void watch_disable_adc(void) { ADC->CTRLA.bit.ENABLE = 0; _watch_sync_adc(); diff --git a/watch-library/watch/watch_adc.h b/watch-library/watch/watch_adc.h index a4f9edad..aa7c801a 100644 --- a/watch-library/watch/watch_adc.h +++ b/watch-library/watch/watch_adc.h @@ -36,7 +36,7 @@ /** @brief Enables the ADC peripheral. You must call this before attempting to read a value * from an analog pin. */ -void watch_enable_adc(); +void watch_enable_adc(void); /** @brief Configures the selected pin for analog input. * @param pin One of pins A0-A4. @@ -139,7 +139,7 @@ void watch_set_analog_reference_voltage(watch_adc_reference_voltage reference); * @note This function depends on INTREF being 1.024V. If you have changed it by poking at the supply * controller's VREF.SEL bits, this function will return inaccurate values. */ -uint16_t watch_get_vcc_voltage(); +uint16_t watch_get_vcc_voltage(void); /** @brief Disables the analog circuitry on the selected pin. * @param pin One of pins A0-A4. @@ -151,7 +151,7 @@ void watch_disable_analog_input(const uint8_t pin); * have the default settings of 16 samples and 1 measurement cycle; if you customized these * parameters, you will need to set them up again. **/ -void watch_disable_adc(); +void watch_disable_adc(void); /// @} #endif diff --git a/watch-library/watch/watch_app.h b/watch-library/watch/watch_app.h index 56b9bfd3..4fa29df8 100644 --- a/watch-library/watch/watch_app.h +++ b/watch-library/watch/watch_app.h @@ -55,13 +55,13 @@ * anything else. Use it to set up any internal data structures or application state required by your app, * but don't configure any peripherals just yet. */ -void app_init(); +void app_init(void); /** @brief A function you will implement to wake from BACKUP mode, which wipes the system's RAM, and with it, your * application's state. You may have chosen to store some important application state in the RTC's backup * registers prior to entering this mode. You may restore that state here. */ -void app_wake_from_backup(); +void app_wake_from_backup(void); /** @brief A function you will implement to set up your application. The app_setup function is like setup() in Arduino. * It is called once when the program begins. You should set pin modes and enable any peripherals you want to @@ -71,7 +71,7 @@ void app_wake_from_backup(); * @note If your app enters the ultra-low power BACKUP sleep mode, this function will be called again when it wakes * from that deep sleep state. In this state, the RTC will still be configured with the correct date and time. */ -void app_setup(); +void app_setup(void); /** @brief A function you will implement to serve as the app's main run loop. This method will be called repeatedly, or if you enter STANDBY mode, as soon as the device wakes from sleep. @@ -86,7 +86,7 @@ void app_setup(); * so e.g. the I2C controller, if configured, will sleep in STANDBY. But you can use it again as soon as your * app wakes up. */ -bool app_loop(); +bool app_loop(void); /** @brief A function you will implement to prepare to enter STANDBY mode. The app_prepare_for_standby function is * called after your app_loop function returns true, and just before the watch enters STANDBY mode. In this @@ -98,11 +98,11 @@ bool app_loop(); * buzzer that could damage it if left in this state. If your app_loop does not prevent sleep during these * activities, you should make sure to disable these outputs in app_prepare_for_standby. */ -void app_prepare_for_standby(); +void app_prepare_for_standby(void); /** @brief A method you will implement to configure the app after waking from STANDBY mode. */ -void app_wake_from_standby(); +void app_wake_from_standby(void); /// @} #endif diff --git a/watch-library/watch/watch_buzzer.c b/watch-library/watch/watch_buzzer.c index 007a44ca..a275b00d 100644 --- a/watch-library/watch/watch_buzzer.c +++ b/watch-library/watch/watch_buzzer.c @@ -24,7 +24,7 @@ #include "watch_buzzer.h" - inline void watch_enable_buzzer() { + inline void watch_enable_buzzer(void) { if (!hri_tcc_get_CTRLA_reg(TCC0, TCC_CTRLA_ENABLE)) { _watch_enable_tcc(); } @@ -33,16 +33,16 @@ inline void watch_set_buzzer_period(uint32_t period) { hri_tcc_write_PERBUF_reg(TCC0, period); } -void watch_disable_buzzer() { +void watch_disable_buzzer(void) { _watch_disable_tcc(); } -inline void watch_set_buzzer_on() { +inline void watch_set_buzzer_on(void) { gpio_set_pin_direction(BUZZER, GPIO_DIRECTION_OUT); gpio_set_pin_function(BUZZER, WATCH_BUZZER_TCC_PINMUX); } -inline void watch_set_buzzer_off() { +inline void watch_set_buzzer_off(void) { gpio_set_pin_direction(BUZZER, GPIO_DIRECTION_OFF); gpio_set_pin_function(BUZZER, GPIO_PIN_FUNCTION_OFF); } diff --git a/watch-library/watch/watch_buzzer.h b/watch-library/watch/watch_buzzer.h index e15657be..1b5d197c 100644 --- a/watch-library/watch/watch_buzzer.h +++ b/watch-library/watch/watch_buzzer.h @@ -33,7 +33,7 @@ /// @{ /** @brief Enables the TCC peripheral, which drives the buzzer. */ -void watch_enable_buzzer(); +void watch_enable_buzzer(void); /** @brief Sets the period of the buzzer. * @param period The period of a single cycle for the TCC peripheral. You can determine the period for @@ -45,17 +45,17 @@ void watch_set_buzzer_period(uint32_t period); * @note If you are using PWM to set custom LED colors, this method will also disable the LED PWM driver, * since the buzzer and LED both make use of the same peripheral to drive their PWM behavior. */ -void watch_disable_buzzer(); +void watch_disable_buzzer(void); /** @brief Turns the buzzer output on. It will emit a continuous sound at the given frequency. * @note The TCC peripheral that drives the buzzer does not run in standby mode; if you wish for buzzer * output to continue, you should prevent your app from going to sleep. */ -void watch_set_buzzer_on(); +void watch_set_buzzer_on(void); /** @brief Turns the buzzer output off. */ -void watch_set_buzzer_off(); +void watch_set_buzzer_off(void); /// @brief 87 notes for use with watch_buzzer_play_note typedef enum BuzzerNote { diff --git a/watch-library/watch/watch_deepsleep.c b/watch-library/watch/watch_deepsleep.c index 8120617b..1813ff24 100644 --- a/watch-library/watch/watch_deepsleep.c +++ b/watch-library/watch/watch_deepsleep.c @@ -126,7 +126,7 @@ uint32_t watch_get_backup_data(uint8_t reg) { return 0; } -void _watch_disable_all_pins_except_rtc() { +static void _watch_disable_all_pins_except_rtc(void) { uint32_t config = RTC->MODE0.TAMPCTRL.reg; uint32_t portb_pins_to_disable = 0xFFFFFFFF; @@ -141,7 +141,7 @@ void _watch_disable_all_pins_except_rtc() { gpio_set_port_direction(1, portb_pins_to_disable, GPIO_DIRECTION_OFF); } -void _watch_disable_all_peripherals_except_slcd() { +static void _watch_disable_all_peripherals_except_slcd(void) { _watch_disable_tcc(); watch_disable_adc(); watch_disable_external_interrupts(); @@ -151,7 +151,7 @@ void _watch_disable_all_peripherals_except_slcd() { MCLK->APBCMASK.reg &= ~MCLK_APBCMASK_SERCOM3; } -void watch_enter_sleep_mode() { +void watch_enter_sleep_mode(void) { // disable all other peripherals _watch_disable_all_peripherals_except_slcd(); @@ -177,7 +177,7 @@ void watch_enter_sleep_mode() { app_wake_from_standby(); } -void watch_enter_deep_sleep_mode() { +void watch_enter_deep_sleep_mode(void) { // identical to sleep mode except we disable the LCD first. slcd_sync_deinit(&SEGMENT_LCD_0); hri_mclk_clear_APBCMASK_SLCD_bit(SLCD); @@ -185,7 +185,7 @@ void watch_enter_deep_sleep_mode() { watch_enter_sleep_mode(); } -void watch_enter_backup_mode() { +void watch_enter_backup_mode(void) { watch_rtc_disable_all_periodic_callbacks(); _watch_disable_all_peripherals_except_slcd(); slcd_sync_deinit(&SEGMENT_LCD_0); @@ -203,7 +203,7 @@ void watch_enter_shallow_sleep(bool display_on) { } // deprecated -void watch_enter_deep_sleep() { +void watch_enter_deep_sleep(void) { watch_register_extwake_callback(BTN_ALARM, NULL, true); watch_enter_backup_mode(); } diff --git a/watch-library/watch/watch_deepsleep.h b/watch-library/watch/watch_deepsleep.h index a453e763..56d75478 100644 --- a/watch-library/watch/watch_deepsleep.h +++ b/watch-library/watch/watch_deepsleep.h @@ -119,7 +119,7 @@ uint32_t watch_get_backup_data(uint8_t reg); * You can estimate the power consumption of this mode to be on the order of 30 microwatts * (about 10 µA at 3 V). */ -void watch_enter_sleep_mode(); +void watch_enter_sleep_mode(void); /** @brief enters Deep Sleep Mode by disabling all pins and peripherals except the RTC. * @details Short of BACKUP mode, this is the lowest power mode you can enter while retaining your @@ -131,7 +131,7 @@ void watch_enter_sleep_mode(); * All notes from watch_enter_sleep_mode apply here, except for power consumption. You can estimate * the power consumption of this mode to be on the order of 12 microwatts (about 4µA at 3 V). */ -void watch_enter_deep_sleep_mode(); +void watch_enter_deep_sleep_mode(void); /** @brief Enters the SAM L22's lowest-power mode, BACKUP. * @details This function does some housekeeping before entering BACKUP mode. It first disables all pins @@ -148,12 +148,12 @@ void watch_enter_deep_sleep_mode(); * this function unless you have a device on the nine-pin connector with an external interrupt * on pin A2 or A4 (i.e. an accelerometer with an interrupt pin). */ -void watch_enter_backup_mode(); +void watch_enter_backup_mode(void); __attribute__((deprecated("Use watch_enter_sleep_mode or watch_enter_deep_sleep_mode instead"))) void watch_enter_shallow_sleep(bool display_on); __attribute__((deprecated("Use watch_enter_backup_mode instead"))) -void watch_enter_deep_sleep(); +void watch_enter_deep_sleep(void); /// @} #endif diff --git a/watch-library/watch/watch_extint.c b/watch-library/watch/watch_extint.c index d6ad5b60..5924b646 100644 --- a/watch-library/watch/watch_extint.c +++ b/watch-library/watch/watch_extint.c @@ -24,7 +24,7 @@ #include "watch_extint.h" -void watch_enable_external_interrupts() { +void watch_enable_external_interrupts(void) { // Configure EIC to use GCLK3 (the 32.768 kHz crystal) hri_gclk_write_PCHCTRL_reg(GCLK, EIC_GCLK_ID, GCLK_PCHCTRL_GEN_GCLK3_Val | (1 << GCLK_PCHCTRL_CHEN_Pos)); // Enable AHB clock for the EIC @@ -33,7 +33,7 @@ void watch_enable_external_interrupts() { ext_irq_init(); } -void watch_disable_external_interrupts() { +void watch_disable_external_interrupts(void) { ext_irq_deinit(); hri_mclk_clear_APBAMASK_EIC_bit(MCLK); } @@ -106,6 +106,6 @@ inline void watch_register_button_callback(const uint8_t pin, ext_irq_cb_t callb watch_register_interrupt_callback(pin, callback, INTERRUPT_TRIGGER_RISING); } -inline void watch_enable_buttons() { +inline void watch_enable_buttons(void) { watch_enable_external_interrupts(); } diff --git a/watch-library/watch/watch_extint.h b/watch-library/watch/watch_extint.h index cba6c5e1..452461b3 100644 --- a/watch-library/watch/watch_extint.h +++ b/watch-library/watch/watch_extint.h @@ -49,10 +49,10 @@ typedef enum watch_interrupt_trigger { } watch_interrupt_trigger; /// @brief Enables the external interrupt controller. -void watch_enable_external_interrupts(); +void watch_enable_external_interrupts(void); /// @brief Disables the external interrupt controller. -void watch_disable_external_interrupts(); +void watch_disable_external_interrupts(void); /** @brief Configures an external interrupt callback on one of the external interrupt pins. * @details You can set one interrupt callback per pin, and you can monitor for a rising condition, @@ -80,6 +80,6 @@ __attribute__((deprecated("Use watch_register_interrupt_callback or watch_regist void watch_register_button_callback(const uint8_t pin, ext_irq_cb_t callback); __attribute__((deprecated("Use watch_enable_external_interrupts instead"))) -void watch_enable_buttons(); +void watch_enable_buttons(void); /// @} #endif diff --git a/watch-library/watch/watch_i2c.c b/watch-library/watch/watch_i2c.c index d2cf474b..ff20afc6 100644 --- a/watch-library/watch/watch_i2c.c +++ b/watch-library/watch/watch_i2c.c @@ -26,13 +26,13 @@ struct io_descriptor *I2C_0_io; -void watch_enable_i2c() { +void watch_enable_i2c(void) { I2C_0_init(); i2c_m_sync_get_io_descriptor(&I2C_0, &I2C_0_io); i2c_m_sync_enable(&I2C_0); } -void watch_disable_i2c() { +void watch_disable_i2c(void) { i2c_m_sync_disable(&I2C_0); hri_mclk_clear_APBCMASK_SERCOM1_bit(MCLK); } diff --git a/watch-library/watch/watch_i2c.h b/watch-library/watch/watch_i2c.h index 65df49b4..fbcc1a92 100644 --- a/watch-library/watch/watch_i2c.h +++ b/watch-library/watch/watch_i2c.h @@ -35,11 +35,11 @@ /// @{ /** @brief Enables the I2C peripheral. Call this before attempting to interface with I2C devices. */ -void watch_enable_i2c(); +void watch_enable_i2c(void); /** @brief Disables the I2C peripheral. */ -void watch_disable_i2c(); +void watch_disable_i2c(void); /** @brief Sends a series of values to a device on the I2C bus. * @param addr The address of the device you wish to talk to. diff --git a/watch-library/watch/watch_led.c b/watch-library/watch/watch_led.c index 1348c977..52174b54 100644 --- a/watch-library/watch/watch_led.c +++ b/watch-library/watch/watch_led.c @@ -24,13 +24,13 @@ #include "watch_led.h" -void watch_enable_leds() { +void watch_enable_leds(void) { if (!hri_tcc_get_CTRLA_reg(TCC0, TCC_CTRLA_ENABLE)) { _watch_enable_tcc(); } } -void watch_disable_leds() { +void watch_disable_leds(void) { _watch_disable_tcc(); } @@ -52,18 +52,18 @@ void watch_set_led_color(uint8_t red, uint8_t green) { } } -void watch_set_led_red() { +void watch_set_led_red(void) { watch_set_led_color(255, 0); } -void watch_set_led_green() { +void watch_set_led_green(void) { watch_set_led_color(0, 255); } -void watch_set_led_yellow() { +void watch_set_led_yellow(void) { watch_set_led_color(255, 255); } -void watch_set_led_off() { +void watch_set_led_off(void) { watch_set_led_color(0, 0); } diff --git a/watch-library/watch/watch_led.h b/watch-library/watch/watch_led.h index 2b9dead0..9e9f5640 100644 --- a/watch-library/watch/watch_led.h +++ b/watch-library/watch/watch_led.h @@ -46,13 +46,13 @@ * your app is asleep. If, however, you set a custom color using watch_set_led_color, the color will * not display correctly in STANDBY mode. You will need to keep your app running while the LED is on. */ -void watch_enable_leds(); +void watch_enable_leds(void); /** @brief Disables the LEDs. * @note This method will also disable the buzzer, since the buzzer and LED both make use of the same * peripheral to drive their PWM behavior. */ -void watch_disable_leds(); +void watch_disable_leds(void); /** @brief Sets the LED to a custom color by modulating each output's duty cycle. * @param red The red value from 0-255. @@ -66,23 +66,23 @@ void watch_set_led_color(uint8_t red, uint8_t green); /** @brief Sets the red LED to full brightness, and turns the green LED off. * @details Of the two LED's in the RG bi-color LED, the red LED is the less power-efficient one (~4.5 mA). */ -void watch_set_led_red(); +void watch_set_led_red(void); /** @brief Sets the green LED to full brightness, and turns the red LED off. * @details Of the two LED's in the RG bi-color LED, the green LED is the more power-efficient one (~0.44 mA). * @note If your watch has a red/blue LED, this method will set the LED to blue. */ -void watch_set_led_green(); +void watch_set_led_green(void); /** @brief Sets both red and green LEDs to full brightness. * @details The total current draw between the two LED's in this mode will be ~5 mA, which is more than the * watch draws in any other mode. Take care not to drain the battery. * @note If your watch has a red/blue LED, this method will set the LED to pink. */ -void watch_set_led_yellow(); +void watch_set_led_yellow(void); /** @brief Turns both the red and the green LEDs off. */ -void watch_set_led_off(); +void watch_set_led_off(void); __attribute__((deprecated("Use watch_enable_leds instead"))) void watch_enable_led(bool unused); diff --git a/watch-library/watch/watch_private.c b/watch-library/watch/watch_private.c index e652b271..b52c8e4c 100644 --- a/watch-library/watch/watch_private.c +++ b/watch-library/watch/watch_private.c @@ -25,7 +25,7 @@ #include "watch_private.h" #include "tusb.h" -void _watch_init() { +void _watch_init(void) { // disable the LED pin (it may have been enabled by the bootloader) watch_disable_digital_output(RED); @@ -97,7 +97,7 @@ int getentropy(void *buf, size_t buflen) { return 0; } -void _watch_enable_tcc() { +void _watch_enable_tcc(void) { // clock TCC0 with the main clock (8 MHz) and enable the peripheral clock. hri_gclk_write_PCHCTRL_reg(GCLK, TCC0_GCLK_ID, GCLK_PCHCTRL_GEN_GCLK0_Val | GCLK_PCHCTRL_CHEN); hri_mclk_set_APBCMASK_TCC0_bit(MCLK); @@ -143,7 +143,7 @@ void _watch_enable_tcc() { gpio_set_pin_function(GREEN, WATCH_GREEN_TCC_PINMUX); } -void _watch_disable_tcc() { +void _watch_disable_tcc(void) { // disable all PWM pins gpio_set_pin_direction(BUZZER, GPIO_DIRECTION_OFF); gpio_set_pin_function(BUZZER, GPIO_PIN_FUNCTION_OFF); @@ -157,7 +157,7 @@ void _watch_disable_tcc() { hri_mclk_clear_APBCMASK_TCC0_bit(MCLK); } -void _watch_enable_usb() { +void _watch_enable_usb(void) { // disable USB, just in case. hri_usb_clear_CTRLA_ENABLE_bit(USB); @@ -241,7 +241,7 @@ int _write(int file, char *ptr, int len) { } // this method could be overridden to read stuff from the USB console? but no need rn. -int _read() { +int _read(void) { return 0; } diff --git a/watch-library/watch/watch_private.h b/watch-library/watch/watch_private.h index 8045e438..7bb91d1f 100644 --- a/watch-library/watch/watch_private.h +++ b/watch-library/watch/watch_private.h @@ -27,17 +27,24 @@ #include "watch.h" /// Called by main.c while setting up the app. You should not call this from your app. -void _watch_init(); +void _watch_init(void); /// Initializes the real-time clock peripheral. -void _watch_rtc_init(); +void _watch_rtc_init(void); /// Called by buzzer and LED setup functions. You should not call this from your app. -void _watch_enable_tcc(); +void _watch_enable_tcc(void); /// Called by buzzer and LED teardown functions. You should not call this from your app. -void _watch_disable_tcc(); +void _watch_disable_tcc(void); /// Called by main.c if plugged in to USB. You should not call this from your app. -void _watch_enable_usb(); +void _watch_enable_usb(void); + +// this function ends up getting called by printf to log stuff to the USB console. +int _write(int file, char *ptr, int len); + +// this method could be overridden to read stuff from the USB console? but no need rn. +int _read(void); + #endif diff --git a/watch-library/watch/watch_rtc.c b/watch-library/watch/watch_rtc.c index a50da7c4..14a968c4 100644 --- a/watch-library/watch/watch_rtc.c +++ b/watch-library/watch/watch_rtc.c @@ -30,15 +30,15 @@ ext_irq_cb_t btn_alarm_callback; ext_irq_cb_t a2_callback; ext_irq_cb_t a4_callback; -bool _watch_rtc_is_enabled() { +bool _watch_rtc_is_enabled(void) { return RTC->MODE2.CTRLA.bit.ENABLE; } -void _sync_rtc() { +static void _sync_rtc(void) { while (RTC->MODE2.SYNCBUSY.reg); } -void _watch_rtc_init() { +void _watch_rtc_init(void) { MCLK->APBAMASK.reg |= MCLK_APBAMASK_RTC; if (_watch_rtc_is_enabled()) return; // don't reset the RTC if it's already set up. @@ -61,7 +61,7 @@ void watch_rtc_set_date_time(watch_date_time date_time) { _sync_rtc(); } -watch_date_time watch_rtc_get_date_time() { +watch_date_time watch_rtc_get_date_time(void) { watch_date_time retval; _sync_rtc(); @@ -74,7 +74,7 @@ void watch_rtc_register_tick_callback(ext_irq_cb_t callback) { watch_rtc_register_periodic_callback(callback, 1); } -void watch_rtc_disable_tick_callback() { +void watch_rtc_disable_tick_callback(void) { watch_rtc_disable_periodic_callback(1); } @@ -102,7 +102,7 @@ void watch_rtc_disable_periodic_callback(uint8_t frequency) { RTC->MODE2.INTENCLR.reg = 1 << per_n; } -void watch_rtc_disable_all_periodic_callbacks() { +void watch_rtc_disable_all_periodic_callbacks(void) { RTC->MODE2.INTENCLR.reg = 0xFF; } @@ -116,7 +116,7 @@ void watch_rtc_register_alarm_callback(ext_irq_cb_t callback, watch_date_time al RTC->MODE2.INTENSET.reg = RTC_MODE2_INTENSET_ALARM0; } -void watch_rtc_disable_alarm_callback() { +void watch_rtc_disable_alarm_callback(void) { RTC->MODE2.INTENCLR.reg = RTC_MODE2_INTENCLR_ALARM0; } diff --git a/watch-library/watch/watch_rtc.h b/watch-library/watch/watch_rtc.h index 7ddd7483..6dac63f5 100644 --- a/watch-library/watch/watch_rtc.h +++ b/watch-library/watch/watch_rtc.h @@ -63,7 +63,7 @@ typedef enum watch_rtc_alarm_match { /** @brief Called by main.c to check if the RTC is enabled. * You may call this function, but outside of app_init, it should always return true. */ -bool _watch_rtc_is_enabled(); +bool _watch_rtc_is_enabled(void); /** @brief Sets the date and time. * @param date_time The date and time you wish to set, with a year value from 0-63 representing 2020-2083. @@ -79,7 +79,7 @@ void watch_rtc_set_date_time(watch_date_time date_time); * @return A watch_date_time with the current date and time, with a year value from 0-63 representing 2020-2083. * @see watch_rtc_set_date_time for notes about how the year is stored. */ -watch_date_time watch_rtc_get_date_time(); +watch_date_time watch_rtc_get_date_time(void); /** @brief Registers an alarm callback that will be called when the RTC time matches the target time, as masked * by the provided mask. @@ -100,7 +100,7 @@ void watch_rtc_register_alarm_callback(ext_irq_cb_t callback, watch_date_time al /** @brief Disables the alarm callback. */ -void watch_rtc_disable_alarm_callback(); +void watch_rtc_disable_alarm_callback(void); /** @brief Registers a "tick" callback that will be called once per second. * @param callback The function you wish to have called when the clock ticks. If you pass in NULL, the tick @@ -113,7 +113,7 @@ void watch_rtc_register_tick_callback(ext_irq_cb_t callback); /** @brief Disables the tick callback for the given period. */ -void watch_rtc_disable_tick_callback(); +void watch_rtc_disable_tick_callback(void); /** @brief Registers a callback that will be called at a configurable period. * @param callback The function you wish to have called at the specified period. If you pass in NULL, the periodic @@ -139,7 +139,7 @@ void watch_rtc_disable_periodic_callback(uint8_t frequency); /** @brief Disables all periodic callbacks, including the once-per-second tick callback. */ -void watch_rtc_disable_all_periodic_callbacks(); +void watch_rtc_disable_all_periodic_callbacks(void); /** @brief Sets the system date and time. * @param date_time A struct representing the date and time you wish to set. diff --git a/watch-library/watch/watch_slcd.c b/watch-library/watch/watch_slcd.c index a74d4169..4bcb1652 100644 --- a/watch-library/watch/watch_slcd.c +++ b/watch-library/watch/watch_slcd.c @@ -150,11 +150,11 @@ static const uint32_t IndicatorSegments[6] = { SLCD_SEGID(1, 10), // WATCH_INDICATOR_LAP }; -void _sync_slcd() { +static void _sync_slcd(void) { while (SLCD->SYNCBUSY.reg); } -void watch_enable_display() { +void watch_enable_display(void) { SEGMENT_LCD_0_init(); slcd_sync_enable(&SEGMENT_LCD_0); } @@ -167,13 +167,13 @@ inline void watch_clear_pixel(uint8_t com, uint8_t seg) { slcd_sync_seg_off(&SEGMENT_LCD_0, SLCD_SEGID(com, seg)); } -void watch_clear_display() { +void watch_clear_display(void) { SLCD->SDATAL0.reg = 0; SLCD->SDATAL1.reg = 0; SLCD->SDATAL2.reg = 0; } -void watch_display_character(uint8_t character, uint8_t position) { +static void watch_display_character(uint8_t character, uint8_t position) { // special cases for positions 4 and 6 if (position == 4 || position == 6) { if (character == '7') character = '&'; // "lowercase" 7 @@ -245,11 +245,11 @@ void watch_display_string(char *string, uint8_t position) { // printf("________\n %c%c %c%c\n%c%c %c%c %c%c\n--------\n", (position > 0) ? ' ' : string[0], (position > 1) ? ' ' : string[1 - position], (position > 2) ? ' ' : string[2 - position], (position > 3) ? ' ' : string[3 - position], (position > 4) ? ' ' : string[4 - position], (position > 5) ? ' ' : string[5 - position], (position > 6) ? ' ' : string[6 - position], (position > 7) ? ' ' : string[7 - position], (position > 8) ? ' ' : string[8 - position], (position > 9) ? ' ' : string[9 - position]); } -inline void watch_set_colon() { +inline void watch_set_colon(void) { slcd_sync_seg_on(&SEGMENT_LCD_0, SLCD_SEGID(1, 16)); } -inline void watch_clear_colon() { +inline void watch_clear_colon(void) { slcd_sync_seg_off(&SEGMENT_LCD_0, SLCD_SEGID(1, 16)); } @@ -261,7 +261,7 @@ inline void watch_clear_indicator(WatchIndicatorSegment indicator) { slcd_sync_seg_off(&SEGMENT_LCD_0, IndicatorSegments[indicator]); } -void watch_clear_all_indicators() { +void watch_clear_all_indicators(void) { slcd_sync_seg_off(&SEGMENT_LCD_0, SLCD_SEGID(2, 17)); slcd_sync_seg_off(&SEGMENT_LCD_0, SLCD_SEGID(2, 16)); slcd_sync_seg_off(&SEGMENT_LCD_0, SLCD_SEGID(0, 17)); @@ -296,7 +296,7 @@ void watch_start_character_blink(char character, uint32_t duration) { _sync_slcd(); } -void watch_stop_blink() { +void watch_stop_blink(void) { SLCD->CTRLD.bit.FC0EN = 0; SLCD->CTRLD.bit.BLINK = 0; } @@ -307,11 +307,11 @@ void watch_start_tick_animation(uint32_t duration) { slcd_sync_start_animation(&SEGMENT_LCD_0, segs, 1, duration); } -bool watch_tick_animation_is_running() { +bool watch_tick_animation_is_running(void) { return hri_slcd_get_CTRLD_CSREN_bit(SLCD); } -void watch_stop_tick_animation() { +void watch_stop_tick_animation(void) { const uint32_t segs[] = { SLCD_SEGID(0, 2)}; slcd_sync_stop_animation(&SEGMENT_LCD_0, segs, 1); watch_display_character(' ', 8); diff --git a/watch-library/watch/watch_slcd.h b/watch-library/watch/watch_slcd.h index abe4d744..3f550bb0 100644 --- a/watch-library/watch/watch_slcd.h +++ b/watch-library/watch/watch_slcd.h @@ -53,7 +53,7 @@ typedef enum WatchIndicatorSegment { /** @brief Enables the Segment LCD display. * Call this before attempting to set pixels or display strings. */ -void watch_enable_display(); +void watch_enable_display(void); /** @brief Sets a pixel. Use this to manually set a pixel with a given common and segment number. * See <a href="segmap.html">segmap.html</a>. @@ -71,7 +71,7 @@ void watch_clear_pixel(uint8_t com, uint8_t seg); /** @brief Clears all segments of the display, including incicators and the colon. */ -void watch_clear_display(); +void watch_clear_display(void); /** @brief Displays a string at the given position, starting from the top left. There are ten digits. A space in any position will clear that digit. @@ -86,11 +86,11 @@ void watch_display_string(char *string, uint8_t position); /** @brief Turns the colon segment on. */ -void watch_set_colon(); +void watch_set_colon(void); /** @brief Turns the colon segment off. */ -void watch_clear_colon(); +void watch_clear_colon(void); /** @brief Sets an indicator on the LCD. Use this to turn on one of the indicator segments. * @param indicator One of the indicator segments from the enum. @see WatchIndicatorSegment @@ -105,7 +105,7 @@ void watch_clear_indicator(WatchIndicatorSegment indicator); /** @brief Clears all indicator segments. * @see WatchIndicatorSegment */ -void watch_clear_all_indicators(); +void watch_clear_all_indicators(void); /** @brief Blinks a single character in position 7. Does not affect other positions. * @details Six of the seven segments in position 7 (and only position 7) are capable of autonomous @@ -124,7 +124,7 @@ void watch_start_character_blink(char character, uint32_t duration); /** @brief Stops and clears all blinking segments. * @details This will stop all blinking in position 7, and clear all segments in that digit. */ -void watch_stop_blink(); +void watch_stop_blink(void); /** @brief Begins a two-segment "tick-tock" animation in position 8. * @details Six of the seven segments in position 8 (and only position 8) are capable of autonomous @@ -141,11 +141,11 @@ void watch_start_tick_animation(uint32_t duration); /** @brief Checks if the tick animation is currently running. * @return true if the animation is running; false otherwise. */ -bool watch_tick_animation_is_running(); +bool watch_tick_animation_is_running(void); /** @brief Stops the tick/tock animation and clears all animating segments. * @details This will stop the animation and clear all segments in position 8. */ -void watch_stop_tick_animation(); +void watch_stop_tick_animation(void); /// @} #endif |