/** * @brief Disables the Wake-up PINx functionality. * @param WakeUpPinx: Specifies the Power Wake-Up pin to disable. * This parameter can be one of the following values: * @arg PWR_WAKEUP_PIN1 * @arg PWR_WAKEUP_PIN2 available only on STM32F410xx/STM32F446xx devices * @arg PWR_WAKEUP_PIN3 available only on STM32F410xx devices * @retval None */ void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx) { /* Check the parameter */ assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx)); /* Disable the wake up pin */ CLEAR_BIT(PWR->CSR, WakeUpPinx); }
/** * @brief Enable the WakeUp PINx functionality. * @param WakeUpPinPolarity: Specifies which Wake-Up pin to enable. * This parameter can be one of the following legacy values, which sets the default: * polarity detection on high level (rising edge): * @arg PWR_WAKEUP_PIN1, PWR_WAKEUP_PIN2, PWR_WAKEUP_PIN3, PWR_WAKEUP_PIN4, * PWR_WAKEUP_PIN5, PWR_WAKEUP_PIN6 or one of the following values where * the user can explicitly states the enabled pin and the chosen polarity. * @arg PWR_WAKEUP_PIN1_HIGH or PWR_WAKEUP_PIN1_LOW * @arg PWR_WAKEUP_PIN2_HIGH or PWR_WAKEUP_PIN2_LOW * @arg PWR_WAKEUP_PIN3_HIGH or PWR_WAKEUP_PIN3_LOW * @arg PWR_WAKEUP_PIN4_HIGH or PWR_WAKEUP_PIN4_LOW * @arg PWR_WAKEUP_PIN5_HIGH or PWR_WAKEUP_PIN5_LOW * @arg PWR_WAKEUP_PIN6_HIGH or PWR_WAKEUP_PIN6_LOW * @note PWR_WAKEUP_PINx and PWR_WAKEUP_PINx_HIGH are equivalent. * @retval None */ void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinPolarity) { assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinPolarity)); /* Enable and Specify the Wake-Up pin polarity and the pull configuration for the event detection (rising or falling edge) */ MODIFY_REG(PWR->WKUPEPR, PWR_EWUP_MASK, WakeUpPinPolarity); }
/** * @brief Disables the WakeUp PINx functionality. * @param WakeUpPinx: Specifies the Power Wake-Up pin to disable. * This parameter can be one of the following values: * @arg PWR_WAKEUP_PIN1, PWR_WAKEUP_PIN2, PWR_WAKEUP_PIN3 * @retval None */ void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx) { __IO uint32_t tmp = 0; /* Check the parameters */ assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx)); tmp = CSR_EWUP1_BB + (WakeUpPinx << 2); *(__IO uint32_t *) (tmp) = (uint32_t)DISABLE; }
/** * @brief Enable the WakeUp PINx functionality. * @param WakeUpPinPolarity: Specifies which Wake-Up pin to enable. * This parameter can be one of the following legacy values, which sets the default polarity: * detection on high level (rising edge): * @arg PWR_WAKEUP_PIN1, PWR_WAKEUP_PIN2, PWR_WAKEUP_PIN3, PWR_WAKEUP_PIN4, PWR_WAKEUP_PIN5, PWR_WAKEUP_PIN6 * or one of the following value where the user can explicitly states the enabled pin and * the chosen polarity * @arg PWR_WAKEUP_PIN1_HIGH or PWR_WAKEUP_PIN1_LOW * @arg PWR_WAKEUP_PIN2_HIGH or PWR_WAKEUP_PIN2_LOW * @arg PWR_WAKEUP_PIN3_HIGH or PWR_WAKEUP_PIN3_LOW * @arg PWR_WAKEUP_PIN4_HIGH or PWR_WAKEUP_PIN4_LOW * @arg PWR_WAKEUP_PIN5_HIGH or PWR_WAKEUP_PIN5_LOW * @arg PWR_WAKEUP_PIN6_HIGH or PWR_WAKEUP_PIN6_LOW * @note PWR_WAKEUP_PINx and PWR_WAKEUP_PINx_HIGH are equivalent. * @retval None */ void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinPolarity) { assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinPolarity)); /* Enable wake-up pin */ SET_BIT(PWR->CSR2, (PWR_EWUP_MASK & WakeUpPinPolarity)); /* Specifies the Wake-Up pin polarity for the event detection (rising or falling edge) */ MODIFY_REG(PWR->CR2, (PWR_EWUP_MASK & WakeUpPinPolarity), (WakeUpPinPolarity >> 0x06)); }
/** * @brief Enable the WakeUp PINx functionality. * @param WakeUpPinPolarity: Specifies which Wake-Up pin to enable. * This parameter can be one of the following legacy values which set the default polarity * i.e. detection on high level (rising edge): * @arg @ref PWR_WAKEUP_PIN1, PWR_WAKEUP_PIN2, PWR_WAKEUP_PIN3, PWR_WAKEUP_PIN4, PWR_WAKEUP_PIN5 * * or one of the following value where the user can explicitly specify the enabled pin and * the chosen polarity: * @arg @ref PWR_WAKEUP_PIN1_HIGH or PWR_WAKEUP_PIN1_LOW * @arg @ref PWR_WAKEUP_PIN2_HIGH or PWR_WAKEUP_PIN2_LOW * @arg @ref PWR_WAKEUP_PIN3_HIGH or PWR_WAKEUP_PIN3_LOW * @arg @ref PWR_WAKEUP_PIN4_HIGH or PWR_WAKEUP_PIN4_LOW * @arg @ref PWR_WAKEUP_PIN5_HIGH or PWR_WAKEUP_PIN5_LOW * @note PWR_WAKEUP_PINx and PWR_WAKEUP_PINx_HIGH are equivalent. * @retval None */ void HAL_PWR_EnableWakeUpPin(uint32_t WakeUpPinPolarity) { assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinPolarity)); /* Specifies the Wake-Up pin polarity for the event detection (rising or falling edge) */ MODIFY_REG(PWR->CR4, (PWR_CR3_EWUP & WakeUpPinPolarity), (WakeUpPinPolarity >> PWR_WUP_POLARITY_SHIFT)); /* Enable wake-up pin */ SET_BIT(PWR->CR3, (PWR_CR3_EWUP & WakeUpPinPolarity)); }
/** * @brief Enables or disables the WakeUp Pin functionality. * @param PWR_WakeUpPin: specifies the WakeUpPin. * This parameter can be: PWR_WakeUpPin_1, PWR_WakeUpPin_2 or PWR_WakeUpPin_3. * @param NewState: new state of the WakeUp Pin functionality. * This parameter can be: ENABLE or DISABLE. * @retval None */ void PWR_WakeUpPinCmd(uint32_t PWR_WakeUpPin, FunctionalState NewState) { __IO uint32_t tmp = 0; /* Check the parameters */ assert_param(IS_PWR_WAKEUP_PIN(PWR_WakeUpPin)); assert_param(IS_FUNCTIONAL_STATE(NewState)); tmp = CSR_EWUP_BB + PWR_WakeUpPin; *(__IO uint32_t *) (tmp) = (uint32_t)NewState; }
/** * @brief Enables or disables the WakeUp Pin functionality. * @param PWR_WakeUpPinx: specifies the WakeUp Pin. * This parameter can be one of the following values: * @arg PWR_WakeUp_Pin1: WKUP1 pin is used for wakeup from Standby mode. * @arg PWR_WakeUp_Pin2: WKUP2 pin is used for wakeup from Standby mode. * @param NewState: new state of the WakeUp Pin functionality. * This parameter can be: ENABLE or DISABLE. * @retval None */ void PWR_WakeUpPinCmd(uint32_t PWR_WakeUpPinx, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_FUNCTIONAL_STATE(NewState)); assert_param(IS_PWR_WAKEUP_PIN(NewState)); if(PWR_WakeUpPinx == PWR_WakeUp_Pin1) { *(__IO uint32_t *) CSR_EWUP1_BB = (uint32_t)NewState; } else /* PWR_WakeUp_Pin1 */ { *(__IO uint32_t *) CSR_EWUP2_BB = (uint32_t)NewState; } }
/** * @brief Enables or disables the WakeUp Pin functionality. * @param PWR_WakeUpPin: specifies the WakeUpPin. * This parameter can be: PWR_WakeUpPin_1, PWR_WakeUpPin_2 or PWR_WakeUpPin_3. * @param NewState: new state of the WakeUp Pin functionality. * This parameter can be: ENABLE or DISABLE. * @retval None */ void PWR_WakeUpPinCmd(uint32_t PWR_WakeUpPin, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_PWR_WAKEUP_PIN(PWR_WakeUpPin)); assert_param(IS_FUNCTIONAL_STATE(NewState)); if (NewState != DISABLE) { /* Enable the EWUPx pin */ PWR->CSR |= PWR_WakeUpPin; } else { /* Disable the EWUPx pin */ PWR->CSR &= ~PWR_WakeUpPin; } }
/** * @brief Enables or disables the WakeUp Pin functionality. * @param PWR_WakeUpPinx: specifies the WakeUp Pin. * This parameter can be one of the following values: * @arg PWR_WakeUp_Pin1: WKUP1 pin is used for wakeup from Standby mode. * @arg PWR_WakeUp_Pin2: WKUP2 pin is used for wakeup from Standby mode. * @arg PWR_WakeUp_Pin3: WKUP3 pin is used for wakeup from Standby mode.(only for STM32F410xx and STM32F412xG Devices) * @param NewState: new state of the WakeUp Pin functionality. * This parameter can be: ENABLE or DISABLE. * @retval None */ void PWR_WakeUpPinCmd(uint32_t PWR_WakeUpPinx, FunctionalState NewState) { /* Check the parameters */ assert_param(IS_FUNCTIONAL_STATE(NewState)); assert_param(IS_PWR_WAKEUP_PIN(NewState)); if(PWR_WakeUpPinx == PWR_WakeUp_Pin1) /* PWR_WakeUp_Pin1 */ { *(__IO uint32_t *) CSR_EWUP1_BB = (uint32_t)NewState; } #if defined(STM32F410xx)|| defined(STM32F412xG) else if(PWR_WakeUpPinx == PWR_WakeUp_Pin3) /* PWR_WakeUp_Pin3 */ { *(__IO uint32_t *) CSR_EWUP3_BB = (uint32_t)NewState; } #endif /* STM32F410xx */ else /* PWR_WakeUp_Pin2 */ { *(__IO uint32_t *) CSR_EWUP2_BB = (uint32_t)NewState; } }
/** * @brief Disables the WakeUp PINx functionality. * @param WakeUpPinx: Specifies the Power Wake-Up pin to disable. * This parameter can be one of the following values: * @arg PWR_WAKEUP_PIN1 * @arg PWR_WAKEUP_PIN2 * @arg PWR_WAKEUP_PIN3 * @arg PWR_WAKEUP_PIN4 * @arg PWR_WAKEUP_PIN5 * @arg PWR_WAKEUP_PIN6 * @retval None */ void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx) { assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx)); CLEAR_BIT(PWR->CSR2, WakeUpPinx); }
/** * @brief Disables the WakeUp PINx functionality. * @param WakeUpPinx: Specifies the Power Wake-Up pin to disable. * This parameter can be one of the following values: * @arg PWR_WAKEUP_PIN1 * @retval None */ void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx) { /* Check the parameter */ assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx)); *(__IO uint32_t *) CSR_EWUP_BB = (uint32_t)DISABLE; }
/** * @brief Disables the WakeUp PINx functionality. * @param WakeUpPinx: Specifies the Power Wake-Up pin to disable. * This parameter can be values of : * @ref PWREx_WakeUp_Pins * @retval None */ void HAL_PWR_DisableWakeUpPin(uint32_t WakeUpPinx) { /* Check the parameters */ assert_param(IS_PWR_WAKEUP_PIN(WakeUpPinx)); PWR->CSR &= ~(PWR_CSR_EWUP1 << (uint8_t)WakeUpPinx); }