#include "watch.h"
-bool battery_is_low = false;
-
// receives interrupts from MCLK, OSC32KCTRL, OSCCTRL, PAC, PM, SUPC and TAL, whatever that is.
void SYSTEM_Handler(void) {
if (SUPC->INTFLAG.bit.BOD33DET) {
- battery_is_low = true;
SUPC->INTENCLR.bit.BOD33DET = 1;
SUPC->INTFLAG.reg &= ~SUPC_INTFLAG_BOD33DET;
}
}
-bool watch_is_battery_low(void) {
- return battery_is_low;
-}
-
bool watch_is_buzzer_or_led_enabled(void){
return hri_mclk_get_APBCMASK_TCC0_bit(MCLK);
}
#include "watch_private.h"
-/** @brief Returns true when the battery voltage dips below 2.5V.
- * @details A CR2016 battery will have a nominal voltage between 2.9 and 3 volts for most of its lifespan. Once the battery
- * discharges to about 60%, the voltage will drift slightly lower; this may manifest as a dimmer LED. By the time
- * 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(void);
-
/** @brief Returns true if either the buzzer or the LED driver is enabled.
* @details Both the buzzer and the LED use the TCC peripheral to drive their behavior. This function returns true if that
* peripheral is enabled. You can use this function to determine whether you need to call the watch_disable_leds or