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

Function LETIMER_RepeatSet

bsp/efm32/Libraries/emlib/src/em_letimer.c:456–496  ·  view source on GitHub ↗

/ * @brief * Set LETIMER repeat counter register value. * * @note * The setting of a repeat counter register requires synchronization into the * low frequency domain. If the same register is modified before a previous * update has completed, this function will stall until the previous * synchronization has completed. This only applies to the Gecko Family, see * comment in the L

Source from the content-addressed store, hash-verified

454 * Initialization value (<= 0x0000ffff)
455 ******************************************************************************/
456void LETIMER_RepeatSet(LETIMER_TypeDef *letimer,
457 unsigned int rep,
458 uint32_t value)
459{
460 volatile uint32_t *repReg;
461#if defined(_EFM32_GECKO_FAMILY)
462 uint32_t syncbusy;
463#endif
464 EFM_ASSERT(LETIMER_REF_VALID(letimer) &&
465 LETIMER_REP_REG_VALID(rep) &&
466 ((value & ~(_LETIMER_REP0_REP0_MASK >> _LETIMER_REP0_REP0_SHIFT)) == 0));
467
468 /* Initialize selected compare value */
469 switch (rep)
470 {
471 case 0:
472 repReg = &(letimer->REP0);
473#if defined(_EFM32_GECKO_FAMILY)
474 syncbusy = LETIMER_SYNCBUSY_REP0;
475#endif
476 break;
477
478 case 1:
479 repReg = &(letimer->REP1);
480#if defined(_EFM32_GECKO_FAMILY)
481 syncbusy = LETIMER_SYNCBUSY_REP1;
482#endif
483 break;
484
485 default:
486 /* Unknown compare register selected, abort */
487 return;
488 }
489
490#if defined(_EFM32_GECKO_FAMILY)
491 /* LF register about to be modified require sync. busy check */
492 LETIMER_Sync(letimer, syncbusy);
493#endif
494
495 *repReg = value;
496}
497
498
499/***************************************************************************//**

Callers

nothing calls this directly

Calls 1

LETIMER_SyncFunction · 0.85

Tested by

no test coverage detected