1.32.24.27 RTC_Timer16Compare1HasMatched Function

C

bool RTC_Timer16Compare1HasMatched(void)

Summary

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

Description

This function returns true if the 16-bit Timer Compare 1 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 1 and Compare 1). This function will return true if the counter value has matched the Compare 1 value and also resets the hardware status flags if when match has occurred.

The Compare 1 Value could have been configured via MHC or at run time by calling the RTC_Timer16Compare1Set() function. The RTC_Timer16Compare1ValueMatched() 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 1 API option in MHC should have been enabled.

Parameters

None.

Returns

True if Counter has matched Compare 1 Value, False otherwise.

Example

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

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

// Wait till the Compare 1 value has matched.
while(!RTC_Timer16Compare1HasMatched());

Remarks

None.