a tick counter

This commit is contained in:
King Kévin 2016-04-30 12:11:38 +02:00
parent 39d17b4940
commit 5665f035c4
2 changed files with 4 additions and 1 deletions

View File

@ -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
}
}

View File

@ -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