1.39.17.30 RTC_Timer16CounterHasOverflowed Function

C

bool RTC_Timer16CounterHasOverflowed ( void )

Summary

Checks if the 16-bit counter has overflowed

Description

This function returns true if the counter value has matched the configured 16-bit timer period. The counter will be reset and start counting again.

The API can be used to poll period completion when using the timer counter as a timer. Calling the function will clear the internal period match flags if these flags were set at the time of calling the function.

Precondition

RTC_Initialize, RTC_Timer16Start and RTC_Timer16PeriodSet must have been called for the associated RTC instance. The RTC peripheral should have been configured in 16-bit Timer Counter mode.

Parameters

None.

Returns

True, if counter has overflowed, False otherwise.

Example

bool counterOverflowed = false;
RTC_Initialize();
RTC_Timer16PeriodSet(0x3000);
RTC_Timer16CounterSet(0);
RTC_Timer16Start();
do
{
    counterOverflowed = RTC_Timer16CounterHasOverflowed();
}

Remarks

None.