/**
 * @brief  Checks whether the specified RTC interrupt has occurred or not.
 * @param  RTC_IT: specifies the RTC interrupts sources to check.
 *   This parameter can be one of the following values:
 *     @arg RTC_IT_OW: Overflow interrupt
 *     @arg RTC_IT_ALR: Alarm interrupt
 *     @arg RTC_IT_SEC: Second interrupt
 * @retval The new state of the RTC_IT (SET or RESET).
 */
ITStatus RTC_GetITStatus(uint16_t RTC_IT) {
	ITStatus bitstatus = RESET;
	/* Check the parameters */
	assert_param(IS_RTC_GET_IT(RTC_IT));

	bitstatus = (ITStatus) (RTC ->CRL & RTC_IT);
	if (((RTC ->CRH & RTC_IT) != (uint16_t) RESET)
			&& (bitstatus != (uint16_t) RESET)) {
		bitstatus = SET;
	} else {
		bitstatus = RESET;
	}
	return bitstatus;
}
Esempio n. 2
0
/*******************************************************************************
* Function Name  : RTC_GetITStatus
* Description    : Checks whether the specified RTC interrupt has occured or not.
* Input          : - RTC_IT: specifies the RTC interrupts sources to check.
*                    This parameter can be one of the following values:
*                       - RTC_IT_OW: Overflow interrupt
*                       - RTC_IT_ALR: Alarm interrupt
*                       - RTC_IT_SEC: Second interrupt
* Output         : None
* Return         : The new state of the RTC_IT (SET or RESET).
*******************************************************************************/
ITStatus RTC_GetITStatus(u16 RTC_IT)
{
    ITStatus bitstatus = RESET;

    /* Check the parameters */
    assert(IS_RTC_GET_IT(RTC_IT));

    bitstatus = (ITStatus)((RTC->CRL & RTC_IT) != (u16)RESET);

    if (((RTC->CRH & RTC_IT) != (u16)RESET) && bitstatus) {
        bitstatus = SET;
    } else {
        bitstatus = RESET;
    }
    return bitstatus;
}