1.2.19.12 1.3.22.12 1.4.20.12 1.5.21.12 1.6.21.12 1.7.22.12 1.29.21.12 1.30.15.6 1.31.15.6 1.32.24.12 1.33.15.6 1.37.15.6 1.38.20.12 1.39.17.12 1.40.19.12 RTC_Timer32CounterHasOverflowed Function

C

bool RTC_Timer32CounterHasOverflowed ( void )

Summary

Check if the 32-bit counter overflow.

Description

This function will return true if the 32-bit counter has overflowed. An overflow occurs when the counter values transitions from 0xFFFFFFFF to 0x0. This function can be used to validate the timer count when using the timer counter as a counter. Calling the function will clear the internal overflow flags if these flags were set at the time of calling the function.

Precondition

RTC_Initialize, RTC_Timer32Start must have been called for the associated RTC instance. The RTC peripheral should have been configured in 32-bit Timer Counter mode.

Parameters

None.

Returns

true - Counter has overflowed.

false - Counter not overflowed.

Example

uint32_t cycles = 0;
RTC_Initialize();

// Clear the period set as we want to operate as a counter.
RTC_Timer32CompareSet(0);
RTC_Timer32CounterSet(0);
RTC_Timer32Start();

// This is the task who execution duration needs to be measured.
SomeTask();

RTC_Timer32Stop();
if(!RTC_Timer32CounterHasOverflowed())
{
    // cycles will contains the execution time of SomeTask() in terms of
    // timer count.
    cycles = RTC_Timer32CounterGet();
}
else
{
    // Timer overflowed. Handle this differently.
}

Remarks

None.