Added functions RTC_GetTimeAndDate() and RTC_SetTimeAndDate( #150
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There is an essential problem without these 2 new functions:
Determining time and date by subsequent calls of RTC_GetTime() and
RTC_GetDate() will retrieve a wrong result, when there happens a day
transition between the 2 calls.
Setting time and date by subsequent calls of RTC_SetTime() and
RTC_SetDate() will result in a wrong setting, when there happens a day
transition between the 2 calls.
Since time synchronization happens today over networks it isn't totally
unlikely that time will be set to 23:59:59.
Reason2:
2 Subsequent calls will result in a 2 times wait for the RTC_SR_ACKUPD
flag of RTC_SR. A single wait consumes processor time by polling in a
loop for 1 second (as per microcontroller data sheet section 14.5.5).
This PR has also a bugfix and removed unnecessary data from rtc.h. Refer to comments of the commits.