Skip to content

Commit 83855c9

Browse files
committed
fix(u0): LL RTC binary mode support
Signed-off-by: Frederic Pillon <frederic.pillon@st.com>
1 parent 7160e4d commit 83855c9

File tree

1 file changed

+89
-1
lines changed

1 file changed

+89
-1
lines changed

libraries/SrcWrapper/inc/stm32_def.h

Lines changed: 89 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,96 @@
9191
#endif
9292

9393
#if defined(STM32U0xx)
94-
#define RCC_CR_HSIDY_Pos RCC_CR_HSIRDY_Pos
94+
#define RCC_CR_HSIDY_Pos RCC_CR_HSIRDY_Pos
95+
#include "stm32yyxx_ll_rtc.h"
96+
#if !defined(LL_RTC_BINARY_NONE)
97+
#define LL_RTC_BINARY_NONE RTC_BINARY_NONE
9598
#endif
99+
#if !defined(LL_RTC_BINARY_ONLY)
100+
#define LL_RTC_BINARY_ONLY RTC_BINARY_ONLY
101+
#endif
102+
#if !defined(LL_RTC_BINARY_MIX)
103+
#define LL_RTC_BINARY_MIX RTC_BINARY_MIX
104+
#endif
105+
#if !defined(LL_RTC_BINARY_MIX_BCDU_0)
106+
#define LL_RTC_BINARY_MIX_BCDU_0 RTC_BINARY_MIX_BCDU_0
107+
#endif
108+
#if !defined(LL_RTC_BINARY_MIX_BCDU_1)
109+
#define LL_RTC_BINARY_MIX_BCDU_1 RTC_BINARY_MIX_BCDU_1
110+
#endif
111+
#if !defined(LL_RTC_BINARY_MIX_BCDU_2)
112+
#define LL_RTC_BINARY_MIX_BCDU_2 RTC_BINARY_MIX_BCDU_2
113+
#endif
114+
#if !defined(LL_RTC_BINARY_MIX_BCDU_3)
115+
#define LL_RTC_BINARY_MIX_BCDU_3 RTC_BINARY_MIX_BCDU_3
116+
#endif
117+
#if !defined(LL_RTC_BINARY_MIX_BCDU_4)
118+
#define LL_RTC_BINARY_MIX_BCDU_4 RTC_BINARY_MIX_BCDU_4
119+
#endif
120+
#if !defined(LL_RTC_BINARY_MIX_BCDU_5)
121+
#define LL_RTC_BINARY_MIX_BCDU_5 RTC_BINARY_MIX_BCDU_5
122+
#endif
123+
#if !defined(LL_RTC_BINARY_MIX_BCDU_6)
124+
#define LL_RTC_BINARY_MIX_BCDU_6 RTC_BINARY_MIX_BCDU_6
125+
#endif
126+
#if !defined(LL_RTC_BINARY_MIX_BCDU_7)
127+
#define LL_RTC_BINARY_MIX_BCDU_7 RTC_BINARY_MIX_BCDU_7
128+
#endif
129+
130+
/**
131+
* @brief Get Binary mode (Sub Second Register)
132+
* @rmtoll RTC_ICSR BIN LL_RTC_GetBinaryMode
133+
* @param RTCx RTC Instance
134+
* @retval This parameter can be one of the following values:
135+
* @arg @ref LL_RTC_BINARY_NONE
136+
* @arg @ref LL_RTC_BINARY_ONLY
137+
* @arg @ref LL_RTC_BINARY_MIX
138+
* @retval None
139+
*/
140+
__STATIC_INLINE uint32_t LL_RTC_GetBinaryMode(const RTC_TypeDef *RTCx)
141+
{
142+
return (uint32_t)(READ_BIT(RTCx->ICSR, RTC_ICSR_BIN));
143+
}
144+
145+
/**
146+
* @brief Set Binary mode (Sub Second Register)
147+
* @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
148+
* @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function).
149+
* @rmtoll RTC_ICSR BIN LL_RTC_SetBinaryMode
150+
* @param RTCx RTC Instance
151+
* @param BinaryMode can be one of the following values:
152+
* @arg @ref LL_RTC_BINARY_NONE
153+
* @arg @ref LL_RTC_BINARY_ONLY
154+
* @arg @ref LL_RTC_BINARY_MIX
155+
* @retval None
156+
*/
157+
__STATIC_INLINE void LL_RTC_SetBinaryMode(RTC_TypeDef *RTCx, uint32_t BinaryMode)
158+
{
159+
MODIFY_REG(RTCx->ICSR, RTC_ICSR_BIN, BinaryMode);
160+
}
161+
162+
/**
163+
* @brief Set Binary Mix mode BCDU
164+
* @note Bit is write-protected. @ref LL_RTC_DisableWriteProtection function should be called before.
165+
* @note It can be written in initialization mode only (@ref LL_RTC_EnableInitMode function).
166+
* @rmtoll RTC_ICSR BCDU LL_RTC_SetBinMixBCDU
167+
* @param RTCx RTC Instance
168+
* @param BinMixBcdU can be one of the following values:
169+
* @arg @ref LL_RTC_BINARY_MIX_BCDU_0
170+
* @arg @ref LL_RTC_BINARY_MIX_BCDU_1
171+
* @arg @ref LL_RTC_BINARY_MIX_BCDU_2
172+
* @arg @ref LL_RTC_BINARY_MIX_BCDU_3
173+
* @arg @ref LL_RTC_BINARY_MIX_BCDU_4
174+
* @arg @ref LL_RTC_BINARY_MIX_BCDU_5
175+
* @arg @ref LL_RTC_BINARY_MIX_BCDU_6
176+
* @arg @ref LL_RTC_BINARY_MIX_BCDU_7
177+
* @retval None
178+
*/
179+
__STATIC_INLINE void LL_RTC_SetBinMixBCDU(RTC_TypeDef *RTCx, uint32_t BinMixBcdU)
180+
{
181+
MODIFY_REG(RTCx->ICSR, RTC_ICSR_BCDU, BinMixBcdU);
182+
}
183+
#endif // STM32U0xx
96184

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

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy