remove all deprecated functions
This commit is contained in:
parent
35172ce11a
commit
6bdaff5d2a
@ -192,15 +192,3 @@ void watch_enter_backup_mode(void) {
|
||||
// go into backup sleep mode (5). when we exit, the reset controller will take over.
|
||||
sleep(5);
|
||||
}
|
||||
|
||||
// deprecated
|
||||
void watch_enter_shallow_sleep(bool display_on) {
|
||||
if (display_on) watch_enter_sleep_mode();
|
||||
else watch_enter_deep_sleep_mode();
|
||||
}
|
||||
|
||||
// deprecated
|
||||
void watch_enter_deep_sleep(void) {
|
||||
watch_register_extwake_callback(BTN_ALARM, NULL, true);
|
||||
watch_enter_backup_mode();
|
||||
}
|
||||
|
@ -101,11 +101,3 @@ void watch_register_interrupt_callback(const uint8_t pin, ext_irq_cb_t callback,
|
||||
|
||||
ext_irq_register(pin, callback);
|
||||
}
|
||||
|
||||
inline void watch_register_button_callback(const uint8_t pin, ext_irq_cb_t callback) {
|
||||
watch_register_interrupt_callback(pin, callback, INTERRUPT_TRIGGER_RISING);
|
||||
}
|
||||
|
||||
inline void watch_enable_buttons(void) {
|
||||
watch_enable_external_interrupts();
|
||||
}
|
||||
|
@ -34,16 +34,6 @@ void watch_disable_leds(void) {
|
||||
_watch_disable_tcc();
|
||||
}
|
||||
|
||||
void watch_enable_led(bool unused) {
|
||||
(void)unused;
|
||||
watch_enable_leds();
|
||||
}
|
||||
|
||||
void watch_disable_led(bool unused) {
|
||||
(void)unused;
|
||||
watch_disable_leds();
|
||||
}
|
||||
|
||||
void watch_set_led_color(uint8_t red, uint8_t green) {
|
||||
if (hri_tcc_get_CTRLA_reg(TCC0, TCC_CTRLA_ENABLE)) {
|
||||
uint32_t period = hri_tcc_get_PER_reg(TCC0, TCC_PER_MASK);
|
||||
|
@ -260,15 +260,6 @@ int _read(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Alternate function that outputs to the debug UART. useful for debugging USB issues.
|
||||
// int _write(int file, char *ptr, int len) {
|
||||
// (void)file;
|
||||
// int pos = 0;
|
||||
// while(pos < len) watch_debug_putc(ptr[pos++]);
|
||||
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
void USB_Handler(void) {
|
||||
tud_int_handler(0);
|
||||
}
|
||||
|
@ -160,40 +160,3 @@ void RTC_Handler(void) {
|
||||
RTC->MODE2.INTFLAG.reg = RTC_MODE2_INTFLAG_ALARM0;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////
|
||||
// Deprecated functions
|
||||
|
||||
void watch_set_date_time(struct calendar_date_time date_time) {
|
||||
RTC_MODE2_CLOCK_Type val;
|
||||
|
||||
val.bit.SECOND = date_time.time.sec;
|
||||
val.bit.MINUTE = date_time.time.min;
|
||||
val.bit.HOUR = date_time.time.hour;
|
||||
val.bit.DAY = date_time.date.day;
|
||||
val.bit.MONTH = date_time.date.month;
|
||||
val.bit.YEAR = (uint8_t)(date_time.date.year - WATCH_RTC_REFERENCE_YEAR);
|
||||
|
||||
RTC->MODE2.CLOCK.reg = val.reg;
|
||||
|
||||
_sync_rtc();
|
||||
}
|
||||
|
||||
void watch_get_date_time(struct calendar_date_time *date_time) {
|
||||
_sync_rtc();
|
||||
RTC_MODE2_CLOCK_Type val = RTC->MODE2.CLOCK;
|
||||
|
||||
date_time->time.sec = val.bit.SECOND;
|
||||
date_time->time.min = val.bit.MINUTE;
|
||||
date_time->time.hour = val.bit.HOUR;
|
||||
date_time->date.day = val.bit.DAY;
|
||||
date_time->date.month = val.bit.MONTH;
|
||||
date_time->date.year = val.bit.YEAR + WATCH_RTC_REFERENCE_YEAR;
|
||||
}
|
||||
|
||||
void watch_register_tick_callback(ext_irq_cb_t callback) {
|
||||
tick_callbacks[7] = callback;
|
||||
NVIC_ClearPendingIRQ(RTC_IRQn);
|
||||
NVIC_EnableIRQ(RTC_IRQn);
|
||||
RTC->MODE2.INTENSET.reg = RTC_MODE2_INTENSET_PER7;
|
||||
}
|
||||
|
@ -116,70 +116,3 @@ char watch_uart_getc(void) {
|
||||
io_read(uart_io, &retval, 1);
|
||||
return retval;
|
||||
}
|
||||
|
||||
// Begin deprecated functions
|
||||
|
||||
/*
|
||||
* UART methods are Copyright (c) 2014-2017, Alex Taradov <alex@taradov.com>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. The name of the author may not be used to endorse or promote products
|
||||
* derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include "peripheral_clk_config.h"
|
||||
|
||||
void watch_enable_debug_uart(uint32_t baud) {
|
||||
uint64_t br = (uint64_t)65536 * ((CONF_CPU_FREQUENCY * 4) - 16 * baud) / (CONF_CPU_FREQUENCY * 4);
|
||||
|
||||
gpio_set_pin_direction(A2, GPIO_DIRECTION_OUT);
|
||||
gpio_set_pin_function(A2, PINMUX_PB02C_SERCOM3_PAD0);
|
||||
|
||||
MCLK->APBCMASK.reg |= MCLK_APBCMASK_SERCOM3;
|
||||
|
||||
GCLK->PCHCTRL[SERCOM3_GCLK_ID_CORE].reg = GCLK_PCHCTRL_GEN(0) | GCLK_PCHCTRL_CHEN;
|
||||
while (0 == (GCLK->PCHCTRL[SERCOM3_GCLK_ID_CORE].reg & GCLK_PCHCTRL_CHEN));
|
||||
|
||||
SERCOM3->USART.CTRLA.reg =
|
||||
SERCOM_USART_CTRLA_DORD | SERCOM_USART_CTRLA_MODE(1/*USART_INT_CLK*/) |
|
||||
SERCOM_USART_CTRLA_RXPO(1/*PAD1*/) | SERCOM_USART_CTRLA_TXPO(0/*PAD0*/);
|
||||
|
||||
SERCOM3->USART.CTRLB.reg = SERCOM_USART_CTRLB_RXEN | SERCOM_USART_CTRLB_TXEN |
|
||||
SERCOM_USART_CTRLB_CHSIZE(0/*8 bits*/);
|
||||
|
||||
SERCOM3->USART.BAUD.reg = (uint16_t)br;
|
||||
|
||||
SERCOM3->USART.CTRLA.reg |= SERCOM_USART_CTRLA_ENABLE;
|
||||
}
|
||||
|
||||
void watch_debug_putc(char c) {
|
||||
while (!(SERCOM3->USART.INTFLAG.reg & SERCOM_USART_INTFLAG_DRE));
|
||||
SERCOM3->USART.DATA.reg = c;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
void watch_debug_puts(char *s) {
|
||||
while (*s) watch_debug_putc(*s++);
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
@ -151,10 +151,5 @@ void watch_enter_deep_sleep_mode(void);
|
||||
*/
|
||||
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);
|
||||
/// @}
|
||||
#endif
|
||||
|
@ -76,10 +76,5 @@ void watch_disable_external_interrupts(void);
|
||||
*/
|
||||
void watch_register_interrupt_callback(const uint8_t pin, ext_irq_cb_t callback, watch_interrupt_trigger trigger);
|
||||
|
||||
__attribute__((deprecated("Use watch_register_interrupt_callback or watch_register_extwake_callback instead")))
|
||||
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);
|
||||
/// @}
|
||||
#endif
|
||||
|
@ -84,10 +84,5 @@ void watch_set_led_yellow(void);
|
||||
/** @brief Turns both the red and the green LEDs off. */
|
||||
void watch_set_led_off(void);
|
||||
|
||||
__attribute__((deprecated("Use watch_enable_leds instead")))
|
||||
void watch_enable_led(bool unused);
|
||||
|
||||
__attribute__((deprecated("Use watch_disable_leds instead")))
|
||||
void watch_disable_led(bool unused);
|
||||
/// @}
|
||||
#endif
|
||||
|
@ -147,24 +147,5 @@ void watch_rtc_disable_matching_periodic_callbacks(uint8_t mask);
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
__attribute__((deprecated("Use watch_rtc_set_date_time function instead")))
|
||||
void watch_set_date_time(struct calendar_date_time date_time);
|
||||
|
||||
/** @brief Returns the system date and time in the provided struct.
|
||||
* @param date_time A pointer to a calendar_date_time struct. It will have with the correct date and time on return.
|
||||
*/
|
||||
__attribute__((deprecated("Use the watch_rtc_get_date_time function instead")))
|
||||
void watch_get_date_time(struct calendar_date_time *date_time);
|
||||
|
||||
/** @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
|
||||
* interrupt will still be enabled, but no callback function will be called.
|
||||
*/
|
||||
__attribute__((deprecated("Use the watch_rtc_register_tick_callback function instead")))
|
||||
void watch_register_tick_callback(ext_irq_cb_t callback);
|
||||
|
||||
/// @}
|
||||
#endif
|
||||
|
@ -52,24 +52,5 @@ void watch_uart_puts(char *s);
|
||||
*/
|
||||
char watch_uart_getc(void);
|
||||
|
||||
// Begin deprecated functions:
|
||||
|
||||
/** @brief Initializes the debug UART.
|
||||
* @param baud The baud rate
|
||||
*/
|
||||
__attribute__((deprecated("Use watch_enable_uart to enable the UART.")))
|
||||
void watch_enable_debug_uart(uint32_t baud);
|
||||
|
||||
/** @brief Outputs a single character on the debug UART.
|
||||
* @param c The character you wish to output.
|
||||
*/
|
||||
__attribute__((deprecated("Use watch_uart_puts to print to the UART, or printf to log debug messages over USB.")))
|
||||
void watch_debug_putc(char c);
|
||||
|
||||
/** @brief Outputs a string on the debug UART.
|
||||
* @param s A null-terminated string.
|
||||
*/
|
||||
__attribute__((deprecated("Use watch_uart_puts to print to the UART, or printf to log debug messages over USB.")))
|
||||
void watch_debug_puts(char *s);
|
||||
/// @}
|
||||
#endif
|
||||
|
@ -86,15 +86,3 @@ void watch_enter_backup_mode(void) {
|
||||
// go into backup sleep mode (5). when we exit, the reset controller will take over.
|
||||
// sleep(5);
|
||||
}
|
||||
|
||||
// deprecated
|
||||
void watch_enter_shallow_sleep(bool display_on) {
|
||||
if (display_on) watch_enter_sleep_mode();
|
||||
else watch_enter_deep_sleep_mode();
|
||||
}
|
||||
|
||||
// deprecated
|
||||
void watch_enter_deep_sleep(void) {
|
||||
watch_register_extwake_callback(BTN_ALARM, NULL, true);
|
||||
watch_enter_backup_mode();
|
||||
}
|
||||
|
@ -181,11 +181,3 @@ void watch_register_interrupt_callback(const uint8_t pin, ext_irq_cb_t callback,
|
||||
external_interrupt_alarm_trigger = trigger;
|
||||
}
|
||||
}
|
||||
|
||||
void watch_register_button_callback(const uint8_t pin, ext_irq_cb_t callback) {
|
||||
watch_register_interrupt_callback(pin, callback, INTERRUPT_TRIGGER_RISING);
|
||||
}
|
||||
|
||||
void watch_enable_buttons(void) {
|
||||
watch_enable_external_interrupts();
|
||||
}
|
||||
|
@ -30,16 +30,6 @@ void watch_enable_leds(void) {}
|
||||
|
||||
void watch_disable_leds(void) {}
|
||||
|
||||
void watch_enable_led(bool unused) {
|
||||
(void)unused;
|
||||
watch_enable_leds();
|
||||
}
|
||||
|
||||
void watch_disable_led(bool unused) {
|
||||
(void)unused;
|
||||
watch_disable_leds();
|
||||
}
|
||||
|
||||
void watch_set_led_color(uint8_t red, uint8_t green) {
|
||||
EM_ASM({
|
||||
document.getElementById('light').style.opacity = $1 / 255;
|
||||
|
@ -67,12 +67,3 @@ int _write(int file, char *ptr, int len) {
|
||||
int _read(void) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Alternate function that outputs to the debug UART. useful for debugging USB issues.
|
||||
// int _write(int file, char *ptr, int len) {
|
||||
// (void)file;
|
||||
// int pos = 0;
|
||||
// while(pos < len) watch_debug_putc(ptr[pos++]);
|
||||
|
||||
// return 0;
|
||||
// }
|
||||
|
@ -197,32 +197,3 @@ void watch_rtc_disable_alarm_callback(void) {
|
||||
alarm_interval_id = -1;
|
||||
}
|
||||
}
|
||||
|
||||
///////////////////////
|
||||
// Deprecated functions
|
||||
|
||||
void watch_set_date_time(struct calendar_date_time date_time) {
|
||||
watch_date_time val;
|
||||
val.unit.second = date_time.time.sec;
|
||||
val.unit.minute = date_time.time.min;
|
||||
val.unit.hour = date_time.time.hour;
|
||||
val.unit.day = date_time.date.day;
|
||||
val.unit.month = date_time.date.month;
|
||||
val.unit.year = date_time.date.year - WATCH_RTC_REFERENCE_YEAR;
|
||||
watch_rtc_set_date_time(val);
|
||||
}
|
||||
|
||||
void watch_get_date_time(struct calendar_date_time *date_time) {
|
||||
if (date_time == NULL) return;
|
||||
watch_date_time val = watch_rtc_get_date_time();
|
||||
date_time->time.sec = val.unit.second;
|
||||
date_time->time.min = val.unit.minute;
|
||||
date_time->time.hour = val.unit.hour;
|
||||
date_time->date.day = val.unit.day;
|
||||
date_time->date.month = val.unit.month;
|
||||
date_time->date.year = val.unit.year + WATCH_RTC_REFERENCE_YEAR;
|
||||
}
|
||||
|
||||
void watch_register_tick_callback(ext_irq_cb_t callback) {
|
||||
watch_rtc_register_tick_callback(callback);
|
||||
}
|
||||
|
@ -45,14 +45,3 @@ char watch_uart_getc(void) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void watch_enable_debug_uart(uint32_t baud) {}
|
||||
|
||||
void watch_debug_putc(char c) {}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
void watch_debug_puts(char *s) {
|
||||
while (*s) watch_debug_putc(*s++);
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
Loading…
x
Reference in New Issue
Block a user