MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / RTC_Init

Function RTC_Init

bsp/efm32/Libraries/emlib/src/em_rtc.c:292–325  ·  view source on GitHub ↗

/ * @brief * Initialize RTC. * * @details * Note that the compare values must be set separately with RTC_CompareSet(). * That should probably be done prior to the use of this function if * configuring the RTC to start when initialization is completed. * * @note * The initialization of the RTC modifies the RTC CTRL register which requires * synchronization into the low frequen

Source from the content-addressed store, hash-verified

290 * Pointer to RTC initialization structure.
291 ******************************************************************************/
292void RTC_Init(const RTC_Init_TypeDef *init)
293{
294 uint32_t tmp;
295
296 if (init->enable)
297 {
298 tmp = RTC_CTRL_EN;
299 }
300 else
301 {
302 tmp = 0;
303 }
304
305 /* Configure DEBUGRUN flag, sets whether or not counter should be
306 * updated when debugger is active */
307 if (init->debugRun)
308 {
309 tmp |= RTC_CTRL_DEBUGRUN;
310 }
311
312 /* Configure COMP0TOP, this will use the COMP0 compare value as an
313 * overflow value, instead of default 24-bit 0x00ffffff */
314 if (init->comp0Top)
315 {
316 tmp |= RTC_CTRL_COMP0TOP;
317 }
318
319#if defined(_EFM32_GECKO_FAMILY)
320 /* LF register about to be modified require sync. busy check */
321 RTC_Sync(RTC_SYNCBUSY_CTRL);
322#endif
323
324 RTC->CTRL = tmp;
325}
326
327
328

Callers 1

rt_hw_rtc_initFunction · 0.50

Calls 1

RTC_SyncFunction · 0.85

Tested by

no test coverage detected