Пример #1
0
/**
  * @brief  Configures the half port interrupt selection.
  * @note   - This function should be called once the port sensitivity configured,
  *         otherwise it will not have any effect on the port external interrupt.
  *         - This function should be called after EXTI_SelectPort() function which
  *         selects the port to be used otherwise ports are selected by default
  * @param  EXTI_HalfPort : The port part to access (MSB or LSB).
  *         This parameter can be a value of @ref EXTI_HalfPort_TypeDef
  * @param  NewState : The external interrupt new state.
  *         This parameter can be a value of @ref FunctionalState.
  * @retval None
  */
void EXTI_SetHalfPortSelection(EXTI_HalfPort_TypeDef EXTI_HalfPort,
                               FunctionalState NewState)
{
  /* Check function parameters */
  assert_param(IS_EXTI_HALFPORT(EXTI_HalfPort));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if ((EXTI_HalfPort & 0x80) == 0x00)
  {
    if (NewState != DISABLE)
    {
      /* Enable port interrupt selector */
      EXTI->CONF1 |= (uint8_t)EXTI_HalfPort;
    }
    else /*NewState == DISABLE */
    {
      /* Disable port interrupt selector */
      EXTI->CONF1 &= (uint8_t)(~(uint8_t)EXTI_HalfPort);
    }
  }
  else
  {
    if (NewState != DISABLE)
    {
      /* Enable port interrupt selector */
      EXTI->CONF2 |= (uint8_t)(EXTI_HalfPort & (uint8_t)0x7F);
    }
    else /*NewState == DISABLE */
    {
      /* Disable port interrupt selector */
      EXTI->CONF2 &= (uint8_t)(~(uint8_t) (EXTI_HalfPort & (uint8_t)0x7F));
    }
  }
}
Пример #2
0
/**
  * @brief  Configure the half port interrupt selection.
  * @note   This function must be called once the port sensitivity is configured,
  *          otherwise this function call won't have any effect on the port external interrupt.
  * @param  EXTI_HalfPort The port part  to access (MSB or LSB).
  *          This parameter can be any combination of the following values:
  *            @arg EXTI_HalfPort_B_LSB:     Interrupt selector PB(3:0)
  *            @arg EXTI_HalfPort_B_MSB:     Interrupt selector PB(7:4)
  *            @arg EXTI_HalfPort_D_LSB:     Interrupt selector PE(3:0)
  *            @arg EXTI_HalfPort_D_MSB:     Interrupt selector PE(7:4)
  * @param  NewState  The external interrupt new state.
  * @retval None
  */
void EXTI_SetHalfPortSelection(EXTI_HalfPort_TypeDef EXTI_HalfPort,
                               FunctionalState NewState)
{
  /* Check function parameters */
  assert_param(IS_EXTI_HALFPORT(EXTI_HalfPort));
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    EXTI->CONF |= (uint8_t)EXTI_HalfPort; /* Enable port interrupt selector */
  }
  else /*NewState == DISABLE */
  {
    EXTI->CONF &= (uint8_t)(~(uint8_t)EXTI_HalfPort); /* Disable port interrupt selector */
  }
}
Пример #3
0
/**
  * @brief  Gets the external interrupt half port configuration.
  * @param  EXTI_HalfPort : The half port part to get (MSB or LSB).
  *   This parameter can be a value of @ref EXTI_HalfPort_TypeDef
  * @retval FunctionalState : The external interrupt state of the selected port part.
  *   This parameter can be a value of @ref FunctionalState.
  */
FunctionalState EXTI_GetHalfPortSelection(EXTI_HalfPort_TypeDef EXTI_HalfPort)
{
  FunctionalState value = DISABLE;
  /* Check function parameters */
  assert_param(IS_EXTI_HALFPORT(EXTI_HalfPort));
  if ((EXTI->CONF1 & (uint8_t)EXTI_HalfPort) != DISABLE)
  {
    value = ENABLE;
  }
  else
  {
    value = DISABLE;
  }

  return(value);
}