1.32.24.25 RTC_Timer16Compare0HasMatched Function

C

bool RTC_Timer16Compare0HasMatched(void)

Summary

Returns true if the 16-bit Timer Compare 0 value has matched the counter.

Description

This function returns true if the 16-bit Timer Compare 0 value has matched the counter. When operating in 16-bit Timer Counter mode, the RTC peripheral compares the counter value with two defined compare values (Compare 0 and Compare 1). This function will return true if the counter value has matched the Compare 0 value and also resets the hardware status flags if when match has occurred.

The Compare 0 Value could have been configured via MHC or at run time by calling the RTC_Timer16Compare0Set() function. The RTC_Timer16Compare0ValueMatched() function allows the application to poll for the compare value match.

Precondition

RTC_Initialize, RTC_Timer16Start must have been called for the associated RTC instance. The RTC value should have been configured for 16-bit Timer Counter Mode. The Generate Compare 0 API option in MHC should have been enabled.

Parameters

None.

Returns

True if counter has matched Compare 0 Value, False otherwise.

Example

RTC_Initialize();
RTC_Timer16CounterSet(0);
RTC_Timer16PeriodSet(0xFFF);

// Calling the RTC_Timer16Compare0Set() function will override the
// Compare 0 value that was set via MHC.
RTC_Timer16Compare0Set(0x3F);
RTC_Timer16Start();

// Wait till the Compare 0 value has matched.
while(!RTC_Timer16Compare0HasMatched());

Remarks

None.