a tick counter
This commit is contained in:
parent
39d17b4940
commit
5665f035c4
|
@ -37,6 +37,7 @@
|
||||||
#include "rtc_ds1307.h" // RTC header and definitions
|
#include "rtc_ds1307.h" // RTC header and definitions
|
||||||
|
|
||||||
#if defined(SQUARE_WAVE_TICKS)
|
#if defined(SQUARE_WAVE_TICKS)
|
||||||
|
volatile uint32_t rtc_ticks = 0;
|
||||||
volatile bool rtc_tick_flag = false;
|
volatile bool rtc_tick_flag = false;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -450,6 +451,7 @@ void SQUARE_WAVE_TIMER_ISR(void)
|
||||||
{
|
{
|
||||||
if (timer_get_flag(SQUARE_WAVE_TIMER, TIM_SR_UIF)) { // overflow even happened
|
if (timer_get_flag(SQUARE_WAVE_TIMER, TIM_SR_UIF)) { // overflow even happened
|
||||||
timer_clear_flag(SQUARE_WAVE_TIMER, TIM_SR_UIF); // clear flag
|
timer_clear_flag(SQUARE_WAVE_TIMER, TIM_SR_UIF); // clear flag
|
||||||
|
rtc_ticks++; // increment count
|
||||||
rtc_tick_flag = true; // update flag
|
rtc_tick_flag = true; // update flag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,8 @@
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
#if defined(SQUARE_WAVE_TICKS)
|
#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
|
#endif
|
||||||
|
|
||||||
/** @brief setup communication with RTC IC
|
/** @brief setup communication with RTC IC
|
||||||
|
|
Loading…
Reference in New Issue