diff --git a/lib/rtc_ds1307.c b/lib/rtc_ds1307.c index b0ed66d..a4956a9 100644 --- a/lib/rtc_ds1307.c +++ b/lib/rtc_ds1307.c @@ -37,6 +37,7 @@ #include "rtc_ds1307.h" // RTC header and definitions #if defined(SQUARE_WAVE_TICKS) +volatile uint32_t rtc_ticks = 0; volatile bool rtc_tick_flag = false; #endif @@ -450,6 +451,7 @@ void SQUARE_WAVE_TIMER_ISR(void) { if (timer_get_flag(SQUARE_WAVE_TIMER, TIM_SR_UIF)) { // overflow even happened timer_clear_flag(SQUARE_WAVE_TIMER, TIM_SR_UIF); // clear flag + rtc_ticks++; // increment count rtc_tick_flag = true; // update flag } } diff --git a/lib/rtc_ds1307.h b/lib/rtc_ds1307.h index 7abe523..2851610 100644 --- a/lib/rtc_ds1307.h +++ b/lib/rtc_ds1307.h @@ -52,7 +52,8 @@ /** @} */ #if defined(SQUARE_WAVE_TICKS) -extern volatile bool rtc_tick_flag; /**< set on SQUARE_WAVE_TICS square wave tics */ +extern volatile uint32_t rtc_ticks; /**< increment on SQUARE_WAVE_TICS square wave ticks */ +extern volatile bool rtc_tick_flag; /**< set on SQUARE_WAVE_TICS square wave ticks */ #endif /** @brief setup communication with RTC IC