2 ******************************************************************************
3 * @file stm32l0xx_hal_comp_ex.c
4 * @author MCD Application Team
6 * @date 06-February-2015
7 * @brief Extended COMP HAL module driver.
8 * @brief This file provides firmware functions to manage the VREFINT
9 * which can act as input to the comparator.
11 ==============================================================================
12 ##### COMP peripheral Extended features #####
13 ==============================================================================
15 [..] Comparing to other previous devices, the COMP interface for STM32L0XX
16 devices contains the following additional features
18 (+) Possibility to enable or disable the VREFINT which is used as input
23 ******************************************************************************
26 * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
28 * Redistribution and use in source and binary forms, with or without modification,
29 * are permitted provided that the following conditions are met:
30 * 1. Redistributions of source code must retain the above copyright notice,
31 * this list of conditions and the following disclaimer.
32 * 2. Redistributions in binary form must reproduce the above copyright notice,
33 * this list of conditions and the following disclaimer in the documentation
34 * and/or other materials provided with the distribution.
35 * 3. Neither the name of STMicroelectronics nor the names of its contributors
36 * may be used to endorse or promote products derived from this software
37 * without specific prior written permission.
39 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
40 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
42 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
43 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
44 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
45 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
46 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
47 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
48 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
50 ******************************************************************************
53 /* Includes ------------------------------------------------------------------*/
54 #include "stm32l0xx_hal.h"
56 /** @addtogroup STM32L0xx_HAL_Driver
60 /** @addtogroup COMPEx
61 * @brief Extended COMP HAL module driver
65 #ifdef HAL_COMP_MODULE_ENABLED
68 /** @addtogroup COMPEx_Exported_Functions
72 /** @addtogroup COMPEx_Exported_Functions_Group1
73 * @brief Extended functions to manage VREFINT for the comparator
79 * @brief Enables the Buffer Vrefint for the COMP.
80 * @note This is functional only if the LOCK bit is not set
84 void HAL_COMPEx_EnableVREFINT(void)
86 /* Enable the Buffer for the COMP by setting EN_VREFINT bit and the ENBUFLP_VREFINT_COMP in the CFGR3 register */
88 SYSCFG->CFGR3 |= (SYSCFG_CFGR3_ENBUFLP_VREFINT_COMP | SYSCFG_CFGR3_EN_VREFINT);
92 * @brief Disables the Buffer Vrefint for the COMP.
93 * @note This is functional only if the LOCK bit is not set
96 void HAL_COMPEx_DisableVREFINT(void)
98 /* Disable the Vrefint by resetting ENBUFLP_BGAP_COMP bit and the EN_VREFINT bit in the CFGR3 register */
100 SYSCFG->CFGR3 &= (uint32_t)~((uint32_t)(SYSCFG_CFGR3_ENBUFLP_VREFINT_COMP | SYSCFG_CFGR3_EN_VREFINT));
112 #endif /* HAL_COMP_MODULE_ENABLED */
120 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/