Skip to content

Commit c9bae67

Browse files
committed
Naming conventions for enums
Signed-off-by: Frederic.Pillon <[email protected]>
1 parent 1d7157a commit c9bae67

File tree

3 files changed

+41
-41
lines changed

3 files changed

+41
-41
lines changed

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ The following functions are not supported:
2727
The following functions have been added to support specific STM32 RTC features:
2828

2929
_RTC hours mode (12 or 24)_
30-
* **`void begin(RTC_Hour_Format format)`**
30+
* **`void begin(Hour_Format format)`**
3131

3232
_RTC clock source_
33-
* **`RTC_Source_Clock setClockSource(void)`** : get current clock source.
34-
* **`void setClockSource(RTC_Source_Clock source)`** : this function must be called before `begin()`.
33+
* **`Source_Clock getClockSource(void)`** : get current clock source.
34+
* **`void setClockSource(Source_Clock source)`** : this function must be called before `begin()`.
3535

3636
_RTC Asynchronous and Synchronous prescaler_
3737
* **`void getPrediv(int8_t *predivA, int16_t *predivS)`** : get user (a)synchronous prescaler values if set else computed ones for the current clock source.
@@ -42,20 +42,20 @@ _SubSeconds management_
4242
* **`void setSubSeconds(uint32_t subSeconds)`**
4343

4444
_Hour format (AM or PM)_
45-
* **`uint8_t getHours(RTC_AM_PM *period)`**
46-
* **`void setHours(uint8_t hours, RTC_AM_PM period)`**
47-
* **`void setTime(uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t subSeconds, RTC_AM_PM period)`**
48-
* **`void setAlarmHours(uint8_t hours, RTC_AM_PM period)`**
49-
* **`uint8_t getAlarmHours(RTC_AM_PM *period)`**
50-
* **`void setAlarmTime(uint8_t hours, uint8_t minutes, uint8_t seconds, RTC_AM_PM period)`**
45+
* **`uint8_t getHours(AM_PM *period)`**
46+
* **`void setHours(uint8_t hours, AM_PM period)`**
47+
* **`void setTime(uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t subSeconds, AM_PM period)`**
48+
* **`void setAlarmHours(uint8_t hours, AM_PM period)`**
49+
* **`uint8_t getAlarmHours(AM_PM *period)`**
50+
* **`void setAlarmTime(uint8_t hours, uint8_t minutes, uint8_t seconds, AM_PM period)`**
5151

5252
_Week day configuration_
5353
* **`uint8_t getWeekDay(void)`**
5454
* **`void setWeekDay(uint8_t weekDay)`**
5555
* **`void setDate(uint8_t weekDay, uint8_t day, uint8_t month, uint8_t year)`**
5656

5757
_Time and date configuration (added for convenience)_
58-
* **`void getTime(uint8_t *hours, uint8_t *minutes, uint8_t *seconds, uint32_t *subSeconds, RTC_AM_PM *period = NULL)`**
58+
* **`void getTime(uint8_t *hours, uint8_t *minutes, uint8_t *seconds, uint32_t *subSeconds, AM_PM *period = NULL)`**
5959
* **`void getDate(uint8_t *weekDay, uint8_t *day, uint8_t *month, uint8_t *year)`**
6060

6161
Refer to the Arduino RTC documentation for the other functions

src/STM32RTC.cpp

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ bool STM32RTC::_configured = false;
5252
* @param format: hour format: HOUR_12 or HOUR_24(default)
5353
* @retval None
5454
*/
55-
void STM32RTC::begin(bool resetTime, RTC_Hour_Format format)
55+
void STM32RTC::begin(bool resetTime, Hour_Format format)
5656
{
5757
if(resetTime == true) {
5858
_configured = false;
@@ -66,7 +66,7 @@ void STM32RTC::begin(bool resetTime, RTC_Hour_Format format)
6666
* @param format: hour format: HOUR_12 or HOUR_24(default)
6767
* @retval None
6868
*/
69-
void STM32RTC::begin(RTC_Hour_Format format)
69+
void STM32RTC::begin(Hour_Format format)
7070
{
7171
if(_configured == false) {
7272
RTC_init((format == HOUR_12)? HOUR_FORMAT_12: HOUR_FORMAT_24,
@@ -108,7 +108,7 @@ void STM32RTC::end(void)
108108
* @brief get the RTC clock source.
109109
* @retval clock source: LSI_CLOCK, LSE_CLOCK or HSE_CLOCK
110110
*/
111-
STM32RTC::RTC_Source_Clock STM32RTC::getClockSource(void)
111+
STM32RTC::Source_Clock STM32RTC::getClockSource(void)
112112
{
113113
return _clockSource;
114114
}
@@ -119,7 +119,7 @@ STM32RTC::RTC_Source_Clock STM32RTC::getClockSource(void)
119119
* @param source: clock source: LSI_CLOCK, LSE_CLOCK or HSE_CLOCK
120120
* @retval None
121121
*/
122-
void STM32RTC::setClockSource(RTC_Source_Clock source)
122+
void STM32RTC::setClockSource(Source_Clock source)
123123
{
124124
if(IS_CLOCK_SOURCE(source)) {
125125
_clockSource = source;
@@ -261,7 +261,7 @@ uint8_t STM32RTC::getMinutes(void)
261261
* pointer to the current hour period set in the RTC: AM or PM
262262
* @retval return the current hours from the RTC.
263263
*/
264-
uint8_t STM32RTC::getHours(RTC_AM_PM *period)
264+
uint8_t STM32RTC::getHours(AM_PM *period)
265265
{
266266
syncTime();
267267
if(period != NULL) {
@@ -280,7 +280,7 @@ uint8_t STM32RTC::getHours(RTC_AM_PM *period)
280280
* pointer to the current hour period set in the RTC: AM or PM
281281
* @retval none
282282
*/
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)
284284
{
285285
syncTime();
286286
if(hours != NULL) {
@@ -401,7 +401,7 @@ uint8_t STM32RTC::getAlarmMinutes(void)
401401
* pointer to the current hour format set in the RTC: AM or PM
402402
* @retval return the current alarm hour.
403403
*/
404-
uint8_t STM32RTC::getAlarmHours(RTC_AM_PM *period)
404+
uint8_t STM32RTC::getAlarmHours(AM_PM *period)
405405
{
406406
syncAlarmTime();
407407
if(period != NULL) {
@@ -516,7 +516,7 @@ void STM32RTC::setHours(uint8_t hours)
516516
* @param hours format: AM or PM
517517
* @retval none
518518
*/
519-
void STM32RTC::setHours(uint8_t hours, RTC_AM_PM period)
519+
void STM32RTC::setHours(uint8_t hours, AM_PM period)
520520
{
521521
if (_configured) {
522522
syncTime();
@@ -560,7 +560,7 @@ void STM32RTC::setTime(uint8_t hours, uint8_t minutes, uint8_t seconds)
560560
* @param hour format: AM or PM
561561
* @retval none
562562
*/
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)
564564
{
565565
if (_configured) {
566566
syncTime();
@@ -744,7 +744,7 @@ void STM32RTC::setAlarmHours(uint8_t hours)
744744
* @param hour format: AM or PM
745745
* @retval none
746746
*/
747-
void STM32RTC::setAlarmHours(uint8_t hours, RTC_AM_PM period)
747+
void STM32RTC::setAlarmHours(uint8_t hours, AM_PM period)
748748
{
749749
if (_configured) {
750750
if(hours < 24) {
@@ -778,7 +778,7 @@ void STM32RTC::setAlarmTime(uint8_t hours, uint8_t minutes, uint8_t seconds)
778778
* @param hour format: AM or PM
779779
* @retval none
780780
*/
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)
782782
{
783783
if (_configured) {
784784
setAlarmHours(hours, period);
@@ -944,7 +944,7 @@ void STM32RTC::setY2kEpoch(uint32_t ts)
944944
* @brief configure RTC source clock for low power
945945
* @param none
946946
*/
947-
void STM32RTC::configForLowPower(RTC_Source_Clock source)
947+
void STM32RTC::configForLowPower(Source_Clock source)
948948
{
949949
#if defined(HAL_PWR_MODULE_ENABLED)
950950
if (!_configured){
@@ -954,7 +954,7 @@ void STM32RTC::configForLowPower(RTC_Source_Clock source)
954954
} else {
955955
if (_clockSource != source) {
956956
// Save current config
957-
RTC_AM_PM period, alarmPeriod = _alarmPeriod;
957+
AM_PM period, alarmPeriod = _alarmPeriod;
958958
uint32_t subSeconds;
959959
uint8_t seconds, minutes, hours, weekDay, day, month, years;
960960
uint8_t alarmSeconds, alarmMinutes, alarmHours, alarmDay;

src/STM32RTC.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,13 @@ typedef void(*voidFuncPtr)(void *);
5555
class STM32RTC {
5656
public:
5757

58-
enum RTC_Hour_Format : uint8_t
58+
enum Hour_Format : uint8_t
5959
{
6060
HOUR_12 = HOUR_FORMAT_12,
6161
HOUR_24 = HOUR_FORMAT_24
6262
};
6363

64-
enum RTC_AM_PM : uint8_t
64+
enum AM_PM : uint8_t
6565
{
6666
AM = HOUR_AM,
6767
PM = HOUR_PM
@@ -79,7 +79,7 @@ class STM32RTC {
7979
MATCH_MMDDHHMMSS = SS_MSK | MM_MSK | HH_MSK | D_MSK | M_MSK,
8080
MATCH_YYMMDDHHMMSS = SS_MSK | MM_MSK | HH_MSK | D_MSK | M_MSK | Y_MSK };
8181

82-
enum RTC_Source_Clock: uint8_t
82+
enum Source_Clock: uint8_t
8383
{
8484
LSI_CLOCK = ::LSI_CLOCK,
8585
LSE_CLOCK = ::LSE_CLOCK,
@@ -95,13 +95,13 @@ class STM32RTC {
9595
STM32RTC(STM32RTC const&) = delete;
9696
void operator=(STM32RTC const&) = delete;
9797

98-
void begin(bool resetTime, RTC_Hour_Format format = HOUR_24);
99-
void begin(RTC_Hour_Format format = HOUR_24);
98+
void begin(bool resetTime, Hour_Format format = HOUR_24);
99+
void begin(Hour_Format format = HOUR_24);
100100

101101
void end(void);
102102

103-
RTC_Source_Clock getClockSource(void);
104-
void setClockSource(RTC_Source_Clock source);
103+
Source_Clock getClockSource(void);
104+
void setClockSource(Source_Clock source);
105105

106106
void enableAlarm(Alarm_Match match);
107107
void disableAlarm(void);
@@ -117,8 +117,8 @@ class STM32RTC {
117117
uint32_t getSubSeconds(void);
118118
uint8_t getSeconds(void);
119119
uint8_t getMinutes(void);
120-
uint8_t getHours(RTC_AM_PM *period = NULL);
121-
void getTime(uint8_t *hours, uint8_t *minutes, uint8_t *seconds, uint32_t *subSeconds, RTC_AM_PM *period = NULL);
120+
uint8_t getHours(AM_PM *period = NULL);
121+
void getTime(uint8_t *hours, uint8_t *minutes, uint8_t *seconds, uint32_t *subSeconds, AM_PM *period = NULL);
122122

123123
uint8_t getWeekDay(void);
124124
uint8_t getDay(void);
@@ -129,7 +129,7 @@ class STM32RTC {
129129
uint32_t getAlarmSubSeconds(void);
130130
uint8_t getAlarmSeconds(void);
131131
uint8_t getAlarmMinutes(void);
132-
uint8_t getAlarmHours(RTC_AM_PM *period = NULL);
132+
uint8_t getAlarmHours(AM_PM *period = NULL);
133133

134134
uint8_t getAlarmDay(void);
135135

@@ -143,9 +143,9 @@ class STM32RTC {
143143
void setSeconds(uint8_t seconds);
144144
void setMinutes(uint8_t minutes);
145145
void setHours(uint8_t hours);
146-
void setHours(uint8_t hours, RTC_AM_PM period);
146+
void setHours(uint8_t hours, AM_PM period);
147147
void setTime(uint8_t hours, uint8_t minutes, uint8_t seconds);
148-
void setTime(uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t subSeconds, RTC_AM_PM period);
148+
void setTime(uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t subSeconds, AM_PM period);
149149

150150
void setWeekDay(uint8_t weekDay);
151151
void setDay(uint8_t day);
@@ -157,9 +157,9 @@ class STM32RTC {
157157
void setAlarmSeconds(uint8_t seconds);
158158
void setAlarmMinutes(uint8_t minutes);
159159
void setAlarmHours(uint8_t hours);
160-
void setAlarmHours(uint8_t hours, RTC_AM_PM period);
160+
void setAlarmHours(uint8_t hours, AM_PM period);
161161
void setAlarmTime(uint8_t hours, uint8_t minutes, uint8_t seconds);
162-
void setAlarmTime(uint8_t hours, uint8_t minutes, uint8_t seconds, RTC_AM_PM period);
162+
void setAlarmTime(uint8_t hours, uint8_t minutes, uint8_t seconds, AM_PM period);
163163

164164
void setAlarmDay(uint8_t day);
165165

@@ -192,7 +192,7 @@ class STM32RTC {
192192

193193
static bool _configured;
194194

195-
RTC_AM_PM _hoursPeriod;
195+
AM_PM _hoursPeriod;
196196
uint8_t _hours;
197197
uint8_t _minutes;
198198
uint8_t _seconds;
@@ -207,13 +207,13 @@ class STM32RTC {
207207
uint8_t _alarmMinutes;
208208
uint8_t _alarmSeconds;
209209
uint32_t _alarmSubSeconds;
210-
RTC_AM_PM _alarmPeriod;
210+
AM_PM _alarmPeriod;
211211
Alarm_Match _alarmMatch;
212212
bool _alarmEnabled;
213213

214-
RTC_Source_Clock _clockSource;
214+
Source_Clock _clockSource;
215215

216-
void configForLowPower(RTC_Source_Clock source);
216+
void configForLowPower(Source_Clock source);
217217

218218
void syncTime(void);
219219
void syncDate(void);

0 commit comments

Comments
 (0)