Exemple #1
0
/***************************************************************************//**
 * @brief
 *   Reset LETIMER to the same state that it was in after a hardware reset.
 *
 * @note
 *   The ROUTE register is NOT reset by this function to allow for
 *   a centralized setup of this feature.
 *
 * @param[in] letimer
 *   A pointer to the LETIMER peripheral register block.
 ******************************************************************************/
void LETIMER_Reset(LETIMER_TypeDef *letimer)
{
#if defined(_LETIMER_FREEZE_MASK)
  /* Freeze registers to avoid stalling for LF synchronization. */
  LETIMER_FreezeEnable(letimer, true);
#endif

  /* Make sure disabled first, before resetting other registers. */
  letimer->CMD = LETIMER_CMD_STOP | LETIMER_CMD_CLEAR
                 | LETIMER_CMD_CTO0 | LETIMER_CMD_CTO1;
  letimer->CTRL  = _LETIMER_CTRL_RESETVALUE;
  letimer->COMP0 = _LETIMER_COMP0_RESETVALUE;
  letimer->COMP1 = _LETIMER_COMP1_RESETVALUE;
  letimer->REP0  = _LETIMER_REP0_RESETVALUE;
  letimer->REP1  = _LETIMER_REP1_RESETVALUE;
  letimer->IEN   = _LETIMER_IEN_RESETVALUE;
  LETIMER_IntClear(letimer, _LETIMER_IF_MASK);

#if defined(_LETIMER_FREEZE_MASK)
  /* Unfreeze registers and pass new settings to LETIMER. */
  LETIMER_FreezeEnable(letimer, false);
#endif

#if defined(_LETIMER_SYNCBUSY_MASK)
  while (LETIMER0->SYNCBUSY & _LETIMER_SYNCBUSY_MASK) {
  }
#endif

#if defined (LETIMER_EN_EN)
  letimer->EN_CLR = LETIMER_EN_EN;
#endif
}
Exemple #2
0
/***************************************************************************//**
 * @brief
 *   Reset LETIMER to same state as after a HW reset.
 *
 * @note
 *   The ROUTE register is NOT reset by this function, in order to allow for
 *   centralized setup of this feature.
 *
 * @param[in] letimer
 *   Pointer to LETIMER peripheral register block.
 ******************************************************************************/
void LETIMER_Reset(LETIMER_TypeDef *letimer)
{
  /* Freeze registers to avoid stalling for LF synchronization */
  LETIMER_FreezeEnable(letimer, true);

  /* Make sure disabled first, before resetting other registers */
  letimer->CMD = LETIMER_CMD_STOP | LETIMER_CMD_CLEAR |
                 LETIMER_CMD_CTO0 | LETIMER_CMD_CTO1;
  letimer->CTRL  = _LETIMER_CTRL_RESETVALUE;
  letimer->COMP0 = _LETIMER_COMP0_RESETVALUE;
  letimer->COMP1 = _LETIMER_COMP1_RESETVALUE;
  letimer->REP0  = _LETIMER_REP0_RESETVALUE;
  letimer->REP1  = _LETIMER_REP1_RESETVALUE;
  letimer->IEN   = _LETIMER_IEN_RESETVALUE;
  letimer->IFC   = _LETIMER_IFC_MASK;
  /* Do not reset route register, setting should be done independently */

  /* Unfreeze registers, pass new settings on to LETIMER */
  LETIMER_FreezeEnable(letimer, false);
}