Skip to content

Commit

Permalink
fix(u0): LL RTC binary mode support
Browse files Browse the repository at this point in the history
Signed-off-by: Frederic Pillon <[email protected]>
  • Loading branch information
fpistm committed Sep 5, 2024
1 parent 4b8b69c commit 86c57ae
Showing 1 changed file with 89 additions and 1 deletion.
90 changes: 89 additions & 1 deletion libraries/SrcWrapper/inc/stm32_def.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,96 @@
#endif

#if defined(STM32U0xx)
#define RCC_CR_HSIDY_Pos RCC_CR_HSIRDY_Pos
#define RCC_CR_HSIDY_Pos RCC_CR_HSIRDY_Pos
#include "stm32yyxx_ll_rtc.h"
#if !defined(LL_RTC_BINARY_NONE)
#define LL_RTC_BINARY_NONE RTC_BINARY_NONE
#endif
#if !defined(LL_RTC_BINARY_ONLY)
#define LL_RTC_BINARY_ONLY RTC_BINARY_ONLY
#endif
#if !defined(LL_RTC_BINARY_MIX)
#define LL_RTC_BINARY_MIX RTC_BINARY_MIX
#endif
#if !defined(LL_RTC_BINARY_MIX_BCDU_0)
#define LL_RTC_BINARY_MIX_BCDU_0 RTC_BINARY_MIX_BCDU_0
#endif
#if !defined(LL_RTC_BINARY_MIX_BCDU_1)
#define LL_RTC_BINARY_MIX_BCDU_1 RTC_BINARY_MIX_BCDU_1
#endif
#if !defined(LL_RTC_BINARY_MIX_BCDU_2)
#define LL_RTC_BINARY_MIX_BCDU_2 RTC_BINARY_MIX_BCDU_2
#endif
#if !defined(LL_RTC_BINARY_MIX_BCDU_3)
#define LL_RTC_BINARY_MIX_BCDU_3 RTC_BINARY_MIX_BCDU_3
#endif
#if !defined(LL_RTC_BINARY_MIX_BCDU_4)
#define LL_RTC_BINARY_MIX_BCDU_4 RTC_BINARY_MIX_BCDU_4
#endif
#if !defined(LL_RTC_BINARY_MIX_BCDU_5)
#define LL_RTC_BINARY_MIX_BCDU_5 RTC_BINARY_MIX_BCDU_5
#endif
#if !defined(LL_RTC_BINARY_MIX_BCDU_6)
#define LL_RTC_BINARY_MIX_BCDU_6 RTC_BINARY_MIX_BCDU_6
#endif
#if !defined(LL_RTC_BINARY_MIX_BCDU_7)
#define LL_RTC_BINARY_MIX_BCDU_7 RTC_BINARY_MIX_BCDU_7
#endif

/**
* @brief Get Binary mode (Sub Second Register)
* @rmtoll RTC_ICSR BIN LL_RTC_GetBinaryMode
* @param RTCx RTC Instance
* @retval This parameter can be one of the following values:
* @arg @ref LL_RTC_BINARY_NONE
* @arg @ref LL_RTC_BINARY_ONLY
* @arg @ref LL_RTC_BINARY_MIX
* @retval None
*/
__STATIC_INLINE uint32_t LL_RTC_GetBinaryMode(const RTC_TypeDef *RTCx)
{
return (uint32_t)(READ_BIT(RTCx->ICSR, RTC_ICSR_BIN));
}

/**
* @brief Set Binary mode (Sub Second Register)
* @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
* @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function).
* @rmtoll RTC_ICSR BIN LL_RTC_SetBinaryMode
* @param RTCx RTC Instance
* @param BinaryMode can be one of the following values:
* @arg @ref LL_RTC_BINARY_NONE
* @arg @ref LL_RTC_BINARY_ONLY
* @arg @ref LL_RTC_BINARY_MIX
* @retval None
*/
__STATIC_INLINE void LL_RTC_SetBinaryMode(RTC_TypeDef *RTCx, uint32_t BinaryMode)
{
MODIFY_REG(RTCx->ICSR, RTC_ICSR_BIN, BinaryMode);
}

/**
* @brief Set Binary Mix mode BCDU
* @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
* @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function).
* @rmtoll RTC_ICSR BCDU LL_RTC_SetBinMixBCDU
* @param RTCx RTC Instance
* @param BinMixBcdU can be one of the following values:
* @arg @ref LL_RTC_BINARY_MIX_BCDU_0
* @arg @ref LL_RTC_BINARY_MIX_BCDU_1
* @arg @ref LL_RTC_BINARY_MIX_BCDU_2
* @arg @ref LL_RTC_BINARY_MIX_BCDU_3
* @arg @ref LL_RTC_BINARY_MIX_BCDU_4
* @arg @ref LL_RTC_BINARY_MIX_BCDU_5
* @arg @ref LL_RTC_BINARY_MIX_BCDU_6
* @arg @ref LL_RTC_BINARY_MIX_BCDU_7
* @retval None
*/
__STATIC_INLINE void LL_RTC_SetBinMixBCDU(RTC_TypeDef *RTCx, uint32_t BinMixBcdU)
{
MODIFY_REG(RTCx->ICSR, RTC_ICSR_BCDU, BinMixBcdU);
}
#endif // STM32U0xx

/* STM32G0xx, STM32U0xx and some STM32U5xx defined USB_DRD_FS */
#if !defined(USB) && defined(USB_DRD_FS)
Expand Down

0 comments on commit 86c57ae

Please sign in to comment.