Closed slavendam closed 4 months ago
A proposal could be introduce a rtc.getFormat (or so) that will return HOUR_12 or HOUR_24 So that you can check the format 12 or 24 hours before setting the Alarm (or Time) Of course when format is 24 hours, HOUR_AM or HOUR_PM are useless
In RTC_StartAlarm function https://github.com/stm32duino/STM32RTC/blob/90414bcb87c41307b9a93b84a4ae589d6d621325/src/rtc.c#L801 it is implemented that user can send 12h hours format, together with AM or PM flag, but that will not be used if 24h format is hardcoded.
If for example user wants to send 14:00h time in 12h format he will send: RTC_StartAlarm(RTC_ALARM_B, 0, 2, 0, 0, 0, HOUR_PM, 31UL); // old
If 24h format is hardcoded alarm will be set at 2:00 AM and user will not have feedback.
From UX side it would be the best to add additional value to hourAM_PM_t enum: https://github.com/stm32duino/STM32RTC/blob/90414bcb87c41307b9a93b84a4ae589d6d621325/src/rtc.h#L67
Modifiying code wherever new hourAM_PM_t is used, will enable user to dinamically set hour format he wants.