/**
  * @brief  Comparator IRQ Handler 
  * @param  hcomp: COMP handle
  * @retval HAL status
  */
void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp)
{
  /* Check which exti line is involved */
  uint32_t extiline = COMP_GET_EXTI_LINE(hcomp->Instance);

  /* Manage COMP1 Exti line */
  if (extiline == COMP_EXTI_LINE_COMP1)
  {
    if(__HAL_COMP_COMP1_EXTI_GET_FLAG() != RESET)
    {
      /* Clear COMP Exti pending bit */
      __HAL_COMP_COMP1_EXTI_CLEAR_FLAG();
      /* COMP trigger user callback */
      HAL_COMP_TriggerCallback(hcomp);
    }
  }

  /* Manage COMP2 Exti line */
  if (extiline == COMP_EXTI_LINE_COMP2)
  {
    if(__HAL_COMP_COMP2_EXTI_GET_FLAG() != RESET)
    {
      /* Clear COMP Exti pending bit */
      __HAL_COMP_COMP2_EXTI_CLEAR_FLAG();
      /* COMP trigger user callback */
      HAL_COMP_TriggerCallback(hcomp);
    }
  }
}
/**
  * @brief  Comparator IRQ handler.
  * @param  hcomp  COMP handle
  * @retval None
  */
void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp)
{
  /* Get the EXTI line corresponding to the selected COMP instance */
  uint32_t exti_line = COMP_GET_EXTI_LINE(hcomp->Instance);
  
  /* Check COMP EXTI flag */
  if(LL_EXTI_IsActiveFlag_0_31(exti_line) != RESET)
  {
    /* Check whether comparator is in independent or window mode */
    if(READ_BIT(COMP12_COMMON->CSR, COMP_CSR_WINMODE) != RESET)
    {
      /* Clear COMP EXTI line pending bit of the pair of comparators          */
      /* in window mode.                                                      */
      /* Note: Pair of comparators in window mode can both trig IRQ when      */
      /*       input voltage is changing from "out of window" area            */
      /*       (low or high ) to the other "out of window" area (high or low).*/
      /*       Both flags must be cleared to call comparator trigger          */
      /*       callback is called once.                                       */
      LL_EXTI_ClearFlag_0_31((COMP_EXTI_LINE_COMP1 | COMP_EXTI_LINE_COMP2));
    }
    else
    {
      /* Clear COMP EXTI line pending bit */
      LL_EXTI_ClearFlag_0_31(exti_line);
    }
    
    /* COMP trigger user callback */
    HAL_COMP_TriggerCallback(hcomp);
  }
}
示例#3
0
/**
  * @brief  Comparator IRQ Handler.
  * @param  hcomp  COMP handle
  * @retval HAL status
  */
void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp)
{
  uint32_t extiline = COMP_GET_EXTI_LINE(hcomp->Instance);
  
  /* Check COMP EXTI flag */
  if(READ_BIT(EXTI->PR1, extiline) != RESET)
  {
    /* Clear COMP EXTI pending bit */
    WRITE_REG(EXTI->PR1, extiline);
  
    /* COMP trigger user callback */
    HAL_COMP_TriggerCallback(hcomp);
  }
}
示例#4
0
/**
  * @brief  Comparator IRQ Handler 
  * @param  hcomp: COMP handle
  * @retval HAL status
  */
void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp)
{
  uint32_t extiline = __HAL_COMP_GET_EXTI_LINE(hcomp->Instance);
  
  /* Check COMP Exti flag */
  if(__HAL_COMP_EXTI_GET_FLAG(extiline) != RESET)
  {
    /* Clear COMP Exti pending bit */
    __HAL_COMP_EXTI_CLEAR_FLAG(extiline);

    /* COMP trigger user callback */
    HAL_COMP_TriggerCallback(hcomp);    
  }  
}
示例#5
0
/**
  * @brief  Comparator IRQ handler.
  * @param  hcomp  COMP handle
  * @retval None
  */
void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp)
{
  /* Get the EXTI line corresponding to the selected COMP instance */
  uint32_t exti_line = COMP_GET_EXTI_LINE(hcomp->Instance);
  
  /* Check COMP EXTI flag */
  if(READ_BIT(EXTI->PR, exti_line) != RESET)
  {
    /* Clear COMP EXTI pending bit */
    WRITE_REG(EXTI->PR, exti_line);
    
    /* COMP trigger user callback */
    HAL_COMP_TriggerCallback(hcomp);
  }
}