@@ -49,10 +49,10 @@ bool STM32RTC::_configured = false;
49
49
/* *
50
50
* @brief initializes the RTC
51
51
* @param resetTime: if true reconfigures the RTC
52
- * @param format: hour format: RTC_HOUR_12 or RTC_HOUR_24 (default)
52
+ * @param format: hour format: HOUR_12 or HOUR_24 (default)
53
53
* @retval None
54
54
*/
55
- void STM32RTC::begin (bool resetTime, RTC_Hour_Format format)
55
+ void STM32RTC::begin (bool resetTime, Hour_Format format)
56
56
{
57
57
if (resetTime == true ) {
58
58
_configured = false ;
@@ -63,15 +63,15 @@ void STM32RTC::begin(bool resetTime, RTC_Hour_Format format)
63
63
64
64
/* *
65
65
* @brief initializes the RTC
66
- * @param format: hour format: RTC_HOUR_12 or RTC_HOUR_24 (default)
66
+ * @param format: hour format: HOUR_12 or HOUR_24 (default)
67
67
* @retval None
68
68
*/
69
- void STM32RTC::begin (RTC_Hour_Format format)
69
+ void STM32RTC::begin (Hour_Format format)
70
70
{
71
71
if (_configured == false ) {
72
- RTC_init ((format == RTC_HOUR_12 )? HOUR_FORMAT_12: HOUR_FORMAT_24,
73
- (_clockSource == RTC_LSE_CLOCK )? LSE_CLOCK:
74
- (_clockSource == RTC_HSE_CLOCK )? HSE_CLOCK : LSI_CLOCK);
72
+ RTC_init ((format == HOUR_12 )? HOUR_FORMAT_12: HOUR_FORMAT_24,
73
+ (_clockSource == LSE_CLOCK )? :: LSE_CLOCK:
74
+ (_clockSource == HSE_CLOCK )? :: HSE_CLOCK : :: LSI_CLOCK);
75
75
// Must be set before call of sync methods
76
76
_configured = true ;
77
77
syncTime ();
@@ -106,25 +106,25 @@ void STM32RTC::end(void)
106
106
107
107
/* *
108
108
* @brief get the RTC clock source.
109
- * @retval clock source: RTC_LSI_CLOCK, RTC_LSE_CLOCK or RTC_HSE_CLOCK
109
+ * @retval clock source: LSI_CLOCK, LSE_CLOCK or HSE_CLOCK
110
110
*/
111
- STM32RTC::RTC_Source_Clock STM32RTC::getClockSource (void )
111
+ STM32RTC::Source_Clock STM32RTC::getClockSource (void )
112
112
{
113
113
return _clockSource;
114
114
}
115
115
116
116
/* *
117
117
* @brief set the RTC clock source. By default LSI clock is selected. This
118
118
* method must be called before begin().
119
- * @param source: clock source: RTC_LSI_CLOCK, RTC_LSE_CLOCK or RTC_HSE_CLOCK
119
+ * @param source: clock source: LSI_CLOCK, LSE_CLOCK or HSE_CLOCK
120
120
* @retval None
121
121
*/
122
- void STM32RTC::setClockSource (RTC_Source_Clock source)
122
+ void STM32RTC::setClockSource (Source_Clock source)
123
123
{
124
124
if (IS_CLOCK_SOURCE (source)) {
125
125
_clockSource = source;
126
- RTC_SetClockSource ((_clockSource == RTC_LSE_CLOCK )? LSE_CLOCK:
127
- (_clockSource == RTC_HSE_CLOCK )? HSE_CLOCK : LSI_CLOCK);
126
+ RTC_SetClockSource ((_clockSource == LSE_CLOCK )? :: LSE_CLOCK:
127
+ (_clockSource == HSE_CLOCK )? :: HSE_CLOCK : :: LSI_CLOCK);
128
128
}
129
129
}
130
130
@@ -174,7 +174,7 @@ void STM32RTC::enableAlarm(Alarm_Match match)
174
174
case MATCH_MMSS:
175
175
case MATCH_SS:
176
176
RTC_StartAlarm (_alarmDay, _alarmHours, _alarmMinutes, _alarmSeconds,
177
- _alarmSubSeconds, (_alarmPeriod == RTC_AM )? AM: PM ,
177
+ _alarmSubSeconds, (_alarmPeriod == AM )? HOUR_AM: HOUR_PM ,
178
178
static_cast <uint8_t >(_alarmMatch));
179
179
_alarmEnabled = true ;
180
180
break ;
@@ -261,7 +261,7 @@ uint8_t STM32RTC::getMinutes(void)
261
261
* pointer to the current hour period set in the RTC: AM or PM
262
262
* @retval return the current hours from the RTC.
263
263
*/
264
- uint8_t STM32RTC::getHours (RTC_AM_PM *period)
264
+ uint8_t STM32RTC::getHours (AM_PM *period)
265
265
{
266
266
syncTime ();
267
267
if (period != NULL ) {
@@ -280,7 +280,7 @@ uint8_t STM32RTC::getHours(RTC_AM_PM *period)
280
280
* pointer to the current hour period set in the RTC: AM or PM
281
281
* @retval none
282
282
*/
283
- void STM32RTC::getTime (uint8_t *hours, uint8_t *minutes, uint8_t *seconds, uint32_t *subSeconds, RTC_AM_PM *period)
283
+ void STM32RTC::getTime (uint8_t *hours, uint8_t *minutes, uint8_t *seconds, uint32_t *subSeconds, AM_PM *period)
284
284
{
285
285
syncTime ();
286
286
if (hours != NULL ) {
@@ -401,7 +401,7 @@ uint8_t STM32RTC::getAlarmMinutes(void)
401
401
* pointer to the current hour format set in the RTC: AM or PM
402
402
* @retval return the current alarm hour.
403
403
*/
404
- uint8_t STM32RTC::getAlarmHours (RTC_AM_PM *period)
404
+ uint8_t STM32RTC::getAlarmHours (AM_PM *period)
405
405
{
406
406
syncAlarmTime ();
407
407
if (period != NULL ) {
@@ -458,7 +458,7 @@ void STM32RTC::setSubSeconds(uint32_t subSeconds)
458
458
if (subSeconds < 1000 ) {
459
459
_subSeconds = subSeconds;
460
460
}
461
- RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == RTC_AM )? AM : PM );
461
+ RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == AM )? HOUR_AM : HOUR_PM );
462
462
}
463
463
}
464
464
@@ -474,7 +474,7 @@ void STM32RTC::setSeconds(uint8_t seconds)
474
474
if (seconds < 60 ) {
475
475
_seconds = seconds;
476
476
}
477
- RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == RTC_AM )? AM : PM );
477
+ RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == AM )? HOUR_AM : HOUR_PM );
478
478
}
479
479
}
480
480
@@ -490,7 +490,7 @@ void STM32RTC::setMinutes(uint8_t minutes)
490
490
if (minutes < 60 ) {
491
491
_minutes = minutes;
492
492
}
493
- RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == RTC_AM )? AM : PM );
493
+ RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == AM )? HOUR_AM : HOUR_PM );
494
494
}
495
495
}
496
496
@@ -506,7 +506,7 @@ void STM32RTC::setHours(uint8_t hours)
506
506
if (hours < 24 ) {
507
507
_hours = hours;
508
508
}
509
- RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == RTC_AM )? AM : PM );
509
+ RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == AM )? HOUR_AM : HOUR_PM );
510
510
}
511
511
}
512
512
@@ -516,15 +516,15 @@ void STM32RTC::setHours(uint8_t hours)
516
516
* @param hours format: AM or PM
517
517
* @retval none
518
518
*/
519
- void STM32RTC::setHours (uint8_t hours, RTC_AM_PM period)
519
+ void STM32RTC::setHours (uint8_t hours, AM_PM period)
520
520
{
521
521
if (_configured) {
522
522
syncTime ();
523
523
if (hours < 24 ) {
524
524
_hours = hours;
525
525
}
526
526
_hoursPeriod = period;
527
- RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == RTC_AM )? AM : PM );
527
+ RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == AM )? HOUR_AM : HOUR_PM );
528
528
}
529
529
}
530
530
@@ -548,7 +548,7 @@ void STM32RTC::setTime(uint8_t hours, uint8_t minutes, uint8_t seconds)
548
548
if (hours < 24 ) {
549
549
_hours = hours;
550
550
}
551
- RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == RTC_AM )? AM : PM );
551
+ RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == AM )? HOUR_AM : HOUR_PM );
552
552
}
553
553
}
554
554
@@ -560,7 +560,7 @@ void STM32RTC::setTime(uint8_t hours, uint8_t minutes, uint8_t seconds)
560
560
* @param hour format: AM or PM
561
561
* @retval none
562
562
*/
563
- void STM32RTC::setTime (uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t subSeconds, RTC_AM_PM period)
563
+ void STM32RTC::setTime (uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t subSeconds, AM_PM period)
564
564
{
565
565
if (_configured) {
566
566
syncTime ();
@@ -577,7 +577,7 @@ void STM32RTC::setTime(uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t
577
577
_hours = hours;
578
578
}
579
579
_hoursPeriod = period;
580
- RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == RTC_AM )? AM : PM );
580
+ RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == AM )? HOUR_AM : HOUR_PM );
581
581
}
582
582
}
583
583
@@ -744,7 +744,7 @@ void STM32RTC::setAlarmHours(uint8_t hours)
744
744
* @param hour format: AM or PM
745
745
* @retval none
746
746
*/
747
- void STM32RTC::setAlarmHours (uint8_t hours, RTC_AM_PM period)
747
+ void STM32RTC::setAlarmHours (uint8_t hours, AM_PM period)
748
748
{
749
749
if (_configured) {
750
750
if (hours < 24 ) {
@@ -778,7 +778,7 @@ void STM32RTC::setAlarmTime(uint8_t hours, uint8_t minutes, uint8_t seconds)
778
778
* @param hour format: AM or PM
779
779
* @retval none
780
780
*/
781
- void STM32RTC::setAlarmTime (uint8_t hours, uint8_t minutes, uint8_t seconds, RTC_AM_PM period)
781
+ void STM32RTC::setAlarmTime (uint8_t hours, uint8_t minutes, uint8_t seconds, AM_PM period)
782
782
{
783
783
if (_configured) {
784
784
setAlarmHours (hours, period);
@@ -925,7 +925,7 @@ void STM32RTC::setEpoch(uint32_t ts)
925
925
_seconds = tmp->tm_sec ;
926
926
927
927
RTC_SetDate (_year, _month, _day, _wday);
928
- RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == RTC_AM )? AM : PM );
928
+ RTC_SetTime (_hours, _minutes, _seconds, _subSeconds, (_hoursPeriod == AM )? HOUR_AM : HOUR_PM );
929
929
}
930
930
}
931
931
@@ -944,7 +944,7 @@ void STM32RTC::setY2kEpoch(uint32_t ts)
944
944
* @brief configure RTC source clock for low power
945
945
* @param none
946
946
*/
947
- void STM32RTC::configForLowPower (RTC_Source_Clock source)
947
+ void STM32RTC::configForLowPower (Source_Clock source)
948
948
{
949
949
#if defined(HAL_PWR_MODULE_ENABLED)
950
950
if (!_configured){
@@ -954,7 +954,7 @@ void STM32RTC::configForLowPower(RTC_Source_Clock source)
954
954
} else {
955
955
if (_clockSource != source) {
956
956
// Save current config
957
- RTC_AM_PM period, alarmPeriod = _alarmPeriod;
957
+ AM_PM period, alarmPeriod = _alarmPeriod;
958
958
uint32_t subSeconds;
959
959
uint8_t seconds, minutes, hours, weekDay, day, month, years;
960
960
uint8_t alarmSeconds, alarmMinutes, alarmHours, alarmDay;
@@ -993,9 +993,9 @@ void STM32RTC::configForLowPower(RTC_Source_Clock source)
993
993
void STM32RTC::syncTime (void )
994
994
{
995
995
if (_configured) {
996
- hourAM_PM_t p = AM ;
996
+ hourAM_PM_t p = HOUR_AM ;
997
997
RTC_GetTime (&_hours, &_minutes, &_seconds, &_subSeconds, &p);
998
- _hoursPeriod = (p == AM )? RTC_AM : RTC_PM ;
998
+ _hoursPeriod = (p == HOUR_AM )? AM : PM ;
999
999
}
1000
1000
}
1001
1001
@@ -1017,11 +1017,11 @@ void STM32RTC::syncDate(void)
1017
1017
void STM32RTC::syncAlarmTime (void )
1018
1018
{
1019
1019
if (_configured) {
1020
- hourAM_PM_t p = AM ;
1020
+ hourAM_PM_t p = HOUR_AM ;
1021
1021
uint8_t match;
1022
1022
RTC_GetAlarm (&_alarmDay, &_alarmHours, &_alarmMinutes, &_alarmSeconds,
1023
1023
&_alarmSubSeconds, &p, &match);
1024
- _alarmPeriod = (p == AM )? RTC_AM : RTC_PM ;
1024
+ _alarmPeriod = (p == HOUR_AM )? AM : PM ;
1025
1025
switch (static_cast <Alarm_Match>(match)) {
1026
1026
case MATCH_OFF:
1027
1027
case MATCH_YYMMDDHHMMSS:// kept for compatibility
0 commit comments