Skip to content

PR 177 review: Add RTC driver #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Apr 25, 2018
Merged

Conversation

fpistm
Copy link
Member

@fpistm fpistm commented Apr 24, 2018

Review of #177

This fix and enhance the preview PR:

  • Fix HSE usage:
    • use the best divider possible to have 1MHz as RTC input clock
    • use the correct clock value to compute synchronous and synchronous prescaler
  • Fix asynchronous and synchronous prescaler values computation.
    • Find (a)synchronous prescalers to obtain the 1Hz calendar clock
    • If 1Hz can't be found, give priority to RTC power consumption by choosing the higher possible value for predivA
  • Extend alarm capabilities (before only daily alarm was possible).
  • Made some clean

To do in a further update manage the second alarm: RTC_ALARM_B

fpr and others added 4 commits April 19, 2018 09:19
Signed-off-by: fpr <[email protected]>
#if defined(STM32L100xBA) || defined (STM32L151xBA) || defined (STM32L152xBA) ||\
    defined(STM32L100xC) || defined (STM32L151xC) || defined (STM32L152xC) ||\
    defined (STM32L162xC) || defined(STM32L151xCA) || defined (STM32L151xD) ||\
    defined (STM32L152xCA) || defined (STM32L152xD) || defined (STM32L162xCA) ||\
    defined (STM32L162xD) || defined(STM32L151xE) || defined(STM32L151xDX) ||\
    defined (STM32L152xE) || defined (STM32L152xDX) || defined (STM32L162xE) ||\
    defined (STM32L162xDX)
#define STM32L1_ULPH
#endif

Signed-off-by: Frederic.Pillon <[email protected]>
day -> wday is a week day (1 to 7)
date -> day is day (1 to 31).
  Mainly named "date" in HAL side
format -> period is day period AM or PM.
  Mainly named "time format" in HAL side

Signed-off-by: Frederic.Pillon <[email protected]>
@fpistm fpistm self-assigned this Apr 24, 2018
@fpistm fpistm added enhancement New feature or request review on going labels Apr 24, 2018
@fpistm fpistm added this to the 1.2.1/1.3.0 milestone Apr 24, 2018
@fpistm fpistm mentioned this pull request Apr 24, 2018
Copy link
Member

@LMESTM LMESTM left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only minor comments - LGTM

@@ -546,7 +546,7 @@ void RTC_GetDate(uint8_t *year, uint8_t *month, uint8_t *day, uint8_t *wday)
* @param period: AM or PM if in 12 hours mode else ignored.
* @retval None
*/
void RTC_StartAlarm(uint8_t day, uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t subSeconds, hourAM_PM_t period)
void RTC_StartAlarm(uint8_t day, uint8_t hours, uint8_t minutes, uint8_t seconds, uint32_t subSeconds, hourAM_PM_t period, uint8_t mask)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the "mask" parameter description of the function - need to clarify how this is going to be used

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

fpistm added 4 commits April 25, 2018 09:38
Signed-off-by: Frederic.Pillon <[email protected]>
RTC_SetClockSource() exported
RTC_getPrediv() exported
RTC_computePrediv() added
Hardened code

Signed-off-by: Frederic.Pillon <[email protected]>
Signed-off-by: Frederic.Pillon <[email protected]>
@fpistm fpistm merged commit acc3a8a into stm32duino:master Apr 25, 2018
@fpistm fpistm deleted the pr177-review branch April 25, 2018 12:55
benwaffle pushed a commit to benwaffle/Arduino_Core_STM32 that referenced this pull request Apr 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants