#include "watch.h"
#include <stdlib.h>
+//////////////////////////////////////////////////////////////////////////////////////////
+// Initialization
+
void watch_init() {
// Use switching regulator for lower power consumption.
SUPC->VREG.bit.SEL = 1;
// Not sure if this belongs in every app -- is there a power impact?
delay_driver_init();
}
+//////////////////////////////////////////////////////////////////////////////////////////
+// Segmented Display
static const uint8_t Character_Set[] =
{
}
}
+//////////////////////////////////////////////////////////////////////////////////////////
+// Buttons
+
void watch_enable_buttons() {
EXTERNAL_IRQ_0_init();
}
ext_irq_register(pin, callback);
}
+//////////////////////////////////////////////////////////////////////////////////////////
+// LED
+
bool PWM_0_enabled = false;
void watch_enable_led(bool pwm) {
}
}
+//////////////////////////////////////////////////////////////////////////////////////////
+// Real-time Clock
+
bool watch_rtc_is_enabled() {
return RTC->MODE0.CTRLA.bit.ENABLE;
}
_prescaler_register_callback(&CALENDAR_0.device, &tick_callback);
}
+//////////////////////////////////////////////////////////////////////////////////////////
+// Analog Input
+
static bool ADC_0_ENABLED = false;
void watch_enable_analog(const uint8_t pin) {
}
}
+//////////////////////////////////////////////////////////////////////////////////////////
+// Digital IO
+
void watch_enable_digital_input(const uint8_t pin) {
gpio_set_pin_direction(pin, GPIO_DIRECTION_IN);
gpio_set_pin_function(pin, GPIO_PIN_FUNCTION_OFF);
gpio_set_pin_level(pin, level);
}
+//////////////////////////////////////////////////////////////////////////////////////////
+// I2C
+
struct io_descriptor *I2C_0_io;
void watch_enable_i2c() {
io_read(I2C_0_io, buf, length);
}
+//////////////////////////////////////////////////////////////////////////////////////////
+// Deep Sleep
+
void watch_store_backup_data(uint32_t data, uint8_t reg) {
if (reg < 8) {
RTC->MODE0.BKUP[reg].reg = data;