@@ -443,7 +443,12 @@ void RTC_GetTime(uint8_t *hours, uint8_t *minutes, uint8_t *seconds, uint32_t *s
443443if (subSeconds != NULL ) {
444444* subSeconds = RTC_TimeStruct .SubSeconds ;
445445 }
446+ #else
447+ UNUSED (subSeconds );
446448#endif
449+ #else
450+ UNUSED (period );
451+ UNUSED (subSeconds );
447452#endif /* !STM32F1xx */
448453 }
449454}
@@ -581,27 +586,31 @@ void RTC_StopAlarm(void)
581586
582587/**
583588 * @brief Get RTC alarm
584- * @param day: 1-31( day of the month)
585- * @param hours: 0-12 or 0-23 depends on the hours mode.
589+ * @param day: 1-31 day of the month (optional could be NULL )
590+ * @param hours: 0-12 or 0-23 depends on the hours mode
586591 * @param minutes: 0-59
587592 * @param seconds: 0-59
588593 * @param subSeconds: 0-999 (optional could be NULL)
589594 * @param period: AM or PM (optional could be NULL)
595+ * @param mask: alarm behavior using alarmMask_t combination (optional could be NULL)
596+ * See AN4579 Table 5 for possible values
590597 * @retval None
591598 */
592599void RTC_GetAlarm (uint8_t * day ,uint8_t * hours ,uint8_t * minutes ,uint8_t * seconds ,uint32_t * subSeconds ,hourAM_PM_t * period ,uint8_t * mask )
593600{
594601RTC_AlarmTypeDef RTC_AlarmStructure ;
595602
596- if ((day != NULL ) && ( hours != NULL )&& (minutes != NULL )&& (seconds != NULL ) && ( mask != NULL )) {
603+ if ((hours != NULL )&& (minutes != NULL )&& (seconds != NULL )) {
597604HAL_RTC_GetAlarm (& RtcHandle ,& RTC_AlarmStructure ,RTC_ALARM_A ,RTC_FORMAT_BIN );
598605
599606* seconds = RTC_AlarmStructure .AlarmTime .Seconds ;
600607* minutes = RTC_AlarmStructure .AlarmTime .Minutes ;
601608* hours = RTC_AlarmStructure .AlarmTime .Hours ;
602609
603610#if !defined(STM32F1xx )
604- * day = RTC_AlarmStructure .AlarmDateWeekDay ;
611+ if (day != NULL ) {
612+ * day = RTC_AlarmStructure .AlarmDateWeekDay ;
613+ }
605614if (period != NULL ) {
606615if (RTC_AlarmStructure .AlarmTime .TimeFormat == RTC_HOURFORMAT12_PM ) {
607616* period = PM ;
@@ -613,20 +622,29 @@ void RTC_GetAlarm(uint8_t *day, uint8_t *hours, uint8_t *minutes, uint8_t *secon
613622if (subSeconds != NULL ) {
614623* subSeconds = RTC_AlarmStructure .AlarmTime .SubSeconds ;
615624 }
625+ #else
626+ UNUSED (subSeconds );
616627#endif /* !STM32F2xx && !STM32L1xx || STM32L1_ULPH */
617- * mask = OFF_MSK ;
618- if (!(RTC_AlarmStructure .AlarmMask & RTC_ALARMMASK_SECONDS )) {
619- * mask |=SS_MSK ;
620- }
621- if (!(RTC_AlarmStructure .AlarmMask & RTC_ALARMMASK_MINUTES )) {
622- * mask |=MM_MSK ;
623- }
624- if (!(RTC_AlarmStructure .AlarmMask & RTC_ALARMMASK_HOURS )) {
625- * mask |=HH_MSK ;
626- }
627- if (!(RTC_AlarmStructure .AlarmMask & RTC_ALARMMASK_DATEWEEKDAY )) {
628- * mask |=D_MSK ;
628+ if (mask != NULL ) {
629+ * mask = OFF_MSK ;
630+ if (!(RTC_AlarmStructure .AlarmMask & RTC_ALARMMASK_SECONDS )) {
631+ * mask |=SS_MSK ;
632+ }
633+ if (!(RTC_AlarmStructure .AlarmMask & RTC_ALARMMASK_MINUTES )) {
634+ * mask |=MM_MSK ;
635+ }
636+ if (!(RTC_AlarmStructure .AlarmMask & RTC_ALARMMASK_HOURS )) {
637+ * mask |=HH_MSK ;
638+ }
639+ if (!(RTC_AlarmStructure .AlarmMask & RTC_ALARMMASK_DATEWEEKDAY )) {
640+ * mask |=D_MSK ;
641+ }
629642 }
643+ #else
644+ UNUSED (day );
645+ UNUSED (period );
646+ UNUSED (subSeconds );
647+ UNUSED (mask );
630648#endif /* !STM32F1xx */
631649 }
632650}