/* Configure the RTC Alarm Subseconds value and mask.  */
ErrorStatus RTC_AlarmSubSecondConfig(uint16_t RTC_AlarmSubSecondValue, RTC_AlarmSubSecondMask_TypeDef RTC_AlarmSubSecondMask)
/* Configure the RTC Alarm Subseconds value and mask.  */
ErrorStatus RTC_AlarmSubSecondConfig(uint16_t RTC_AlarmSubSecondValue, RTC_AlarmSubSecondMask_TypeDef RTC_AlarmSubSecondMask)
{
  uint8_t alarmstatus = 0;
  ErrorStatus status = ERROR;
  assert_param(IS_RTC_ALARM_SS_VALUE(RTC_AlarmSubSecondValue));
  assert_param(IS_RTC_ALARM_SS_MASK(RTC_AlarmSubSecondMask));
  RTC_WriteProtectionCmd(DISABLE);
  if ((RTC->ISR1 & RTC_ISR1_INITF) == RESET)
  {
    alarmstatus = (uint8_t)(RTC->CR2 | RTC_CR2_ALRAE);
    RTC->CR2 &= (uint8_t)~(RTC_CR2_ALRAE);
    RTC->ALRMASSRH = (uint8_t)(RTC_AlarmSubSecondValue >> 8);
    RTC->ALRMASSRL = (uint8_t)(RTC_AlarmSubSecondValue);
    RTC->ALRMASSMSKR = (uint8_t)RTC_AlarmSubSecondMask;
    RTC->CR2 |= alarmstatus;
    status = SUCCESS;
  }
  else
  {
    status = ERROR;
  }
  RTC_WriteProtectionCmd(ENABLE);
  return (ErrorStatus)status;
}