Rtc mix in millisec API is using subsecond expressed in milliseconds #95
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.
STM32RTC APi has subsecond parameter which is a value in milliseconds
Becasue of the BINARY MIX mode, the parameter subsecond could be confusing as the subsecond register of the RTC is:
For example, in MIX mode, when RTC is clocked by the LSE (32768Hz) the tick is downcounting at 256Hz
(1 tick is ~ 3.9ms )
The RTC subsecond register is converted in ms by
(0xFFFFFFFF - SubSecReg) * 1000/256
And N miliseconds is converted in ticks (count unit) by
0xFFFFFFFF - (SubSecReg * 256) /1000
With this PR, the STM32RTC API is always giving the subsecond parameter in a nb of milliseconds.
Especially with functions:
getSubSeconds() and getTime()
getAlarmSubSeconds()
setAlarmSubSeconds() and setAlarmTime()
setSubSeconds() and setTime() (but Subsecond value is ignored there RO register)