@@ -443,7 +443,12 @@ void RTC_GetTime(uint8_t *hours, uint8_t *minutes, uint8_t *seconds, uint32_t *s
443
443
if (subSeconds != NULL ) {
444
444
* subSeconds = RTC_TimeStruct .SubSeconds ;
445
445
}
446
+ #else
447
+ UNUSED (subSeconds );
446
448
#endif
449
+ #else
450
+ UNUSED (period );
451
+ UNUSED (subSeconds );
447
452
#endif /* !STM32F1xx */
448
453
}
449
454
}
@@ -581,27 +586,31 @@ void RTC_StopAlarm(void)
581
586
582
587
/**
583
588
* @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
586
591
* @param minutes: 0-59
587
592
* @param seconds: 0-59
588
593
* @param subSeconds: 0-999 (optional could be NULL)
589
594
* @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
590
597
* @retval None
591
598
*/
592
599
void RTC_GetAlarm (uint8_t * day , uint8_t * hours , uint8_t * minutes , uint8_t * seconds , uint32_t * subSeconds , hourAM_PM_t * period , uint8_t * mask )
593
600
{
594
601
RTC_AlarmTypeDef RTC_AlarmStructure ;
595
602
596
- if ((day != NULL ) && ( hours != NULL ) && (minutes != NULL ) && (seconds != NULL ) && ( mask != NULL )) {
603
+ if ((hours != NULL ) && (minutes != NULL ) && (seconds != NULL )) {
597
604
HAL_RTC_GetAlarm (& RtcHandle , & RTC_AlarmStructure , RTC_ALARM_A , RTC_FORMAT_BIN );
598
605
599
606
* seconds = RTC_AlarmStructure .AlarmTime .Seconds ;
600
607
* minutes = RTC_AlarmStructure .AlarmTime .Minutes ;
601
608
* hours = RTC_AlarmStructure .AlarmTime .Hours ;
602
609
603
610
#if !defined(STM32F1xx )
604
- * day = RTC_AlarmStructure .AlarmDateWeekDay ;
611
+ if (day != NULL ) {
612
+ * day = RTC_AlarmStructure .AlarmDateWeekDay ;
613
+ }
605
614
if (period != NULL ) {
606
615
if (RTC_AlarmStructure .AlarmTime .TimeFormat == RTC_HOURFORMAT12_PM ) {
607
616
* period = PM ;
@@ -613,20 +622,29 @@ void RTC_GetAlarm(uint8_t *day, uint8_t *hours, uint8_t *minutes, uint8_t *secon
613
622
if (subSeconds != NULL ) {
614
623
* subSeconds = RTC_AlarmStructure .AlarmTime .SubSeconds ;
615
624
}
625
+ #else
626
+ UNUSED (subSeconds );
616
627
#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
+ }
629
642
}
643
+ #else
644
+ UNUSED (day );
645
+ UNUSED (period );
646
+ UNUSED (subSeconds );
647
+ UNUSED (mask );
630
648
#endif /* !STM32F1xx */
631
649
}
632
650
}
0 commit comments