Skip to content

Commit fa452ad

Browse files
authored
Merge pull request #2 from fpistm/pr177-review
STM32RTC fix and enhancements
2 parents 6cb058c + fdb541d commit fa452ad

File tree

6 files changed

+280
-223
lines changed

6 files changed

+280
-223
lines changed

README.md

+12-8
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,26 @@ The following functions are not supported:
1818
The following functions have been added to support specific STM32 RTC features:
1919

2020
_RTC hours mode (12 or 24)_
21-
* **`void begin(RTCHourFormats_t format)`**
21+
* **`void begin(RTC_Hour_Format format)`**
2222

2323
_RTC clock source_
24-
* **`void setClockSource(sourceClock_t source)`** : this function must be called before `begin()`
24+
* **`void setClockSource(RTC_Source_Clock source)`** : this function must be called before `begin()`.
25+
26+
_RTC Asynchronous and Synchronous prescaler_
27+
* **`void getPrediv(int8_t *predivA, int16_t *predivS)`** : get user (a)synchronous prescaler values if set else computed ones for the current clock source.
28+
* **`void setPrediv(int8_t predivA, int16_t predivS)`** : set user (a)synchronous prescaler values. This function must be called before `begin()`. Use -1 to reset value and use computed ones.
2529

2630
_SubSeconds management_
2731
* **`uint32_t getSubSeconds(void)`**
2832
* **`void setSubSeconds(uint32_t subSeconds)`**
2933

3034
_Hour format (AM or PM)_
31-
* **`uint8_t getHours(Hour12_AM_PM_t *format)`**
32-
* **`void setHours(uint8_t hours, Hour12_AM_PM_t format)`**
33-
* **`void setTime(uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t subSeconds, Hour12_AM_PM_t format)`**
34-
* **`void setAlarmHours(uint8_t hours, Hour12_AM_PM_t format)`**
35-
* **`uint8_t getAlarmHours(Hour12_AM_PM_t *format)`**
36-
* **`void setAlarmTime(uint8_t hours, uint8_t minutes, uint8_t seconds, Hour12_AM_PM_t format)`**
35+
* **`uint8_t getHours(RTC_AM_PM *period)`**
36+
* **`void setHours(uint8_t hours, RTC_AM_PM period)`**
37+
* **`void setTime(uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t subSeconds, RTC_AM_PM period)`**
38+
* **`void setAlarmHours(uint8_t hours, RTC_AM_PM period)`**
39+
* **`uint8_t getAlarmHours(RTC_AM_PM *period)`**
40+
* **`void setAlarmTime(uint8_t hours, uint8_t minutes, uint8_t seconds, RTC_AM_PM period)`**
3741

3842
_Week day configuration_
3943
* **`uint8_t getWeekDay(void)`**

examples/RTCClockSelection/RTCClockSelection.ino

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void setup()
6060

6161
// Select RTC clock source: RTC_LSI_CLOCK, RTC_LSE_CLOCK or RTC_HSE_CLOCK.
6262
// By default the LSI is selected as source.
63-
rtc.setClockSource(RTC_LSE_CLOCK);
63+
rtc.setClockSource(STM32RTC::RTC_LSE_CLOCK);
6464

6565
rtc.begin(); // initialize RTC 24H format
6666

keywords.txt

+18-4
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,28 @@ attachInterrupt KEYWORD2
6262
detachInterrupt KEYWORD2
6363

6464
setClockSource KEYWORD2
65+
isConfigured KEYWORD2
66+
67+
getPrediv KEYWORD2
68+
setPrediv KEYWORD2
69+
70+
IS_CLOCK_SOURCE KEYWORD2
71+
IS_HOUR_FORMAT KEYWORD2
6572

6673
#######################################
6774
# Constants (LITERAL1)
6875
#######################################
69-
HOUR_12 LITERAL1
70-
HOUR_24 LITERAL1
71-
HOUR_AM LITERAL1
72-
HOUR_PM LITERAL1
76+
MATCH_OFF LITERAL1
77+
MATCH_SS LITERAL1
78+
MATCH_MMSS LITERAL1
79+
MATCH_HHMMSS LITERAL1
80+
MATCH_DHHMMSS LITERAL1
81+
MATCH_MMDDHHMMSS LITERAL1
82+
MATCH_YYMMDDHHMMSS LITERAL1
83+
RTC_HOUR_12 LITERAL1
84+
RTC_HOUR_24 LITERAL1
85+
RTC_AM LITERAL1
86+
RTC_PM LITERAL1
7387
RTC_LSE_CLOCK LITERAL1
7488
RTC_LSI_CLOCK LITERAL1
7589
RTC_HSE_CLOCK LITERAL1

library.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
name=STM32duino RTC
22
version=1.0.0
3-
author=Wi6Labs
3+
author=STMicroelectronics, Wi6Labs
44
maintainer=stm32duino
5-
sentence=Allows to use the RTC functionalities. For STM32 boards.
5+
sentence=Allows to use the RTC functionalities of STM32 based boards.
66
paragraph=With this library you can use the RTC peripheral in order to program actions related to date and time.
77
category=Timing
88
url=https://github.com/stm32duino/STM32RTC.git

0 commit comments

Comments
 (0)