]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32L0/stm32l0xx_hal_comp_ex.c
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32L0 / stm32l0xx_hal_comp_ex.c
1 /**
2   ******************************************************************************
3   * @file    stm32l0xx_hal_comp_ex.c
4   * @author  MCD Application Team
5   * @version V1.2.0
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.
10   @verbatim 
11   ==============================================================================
12                ##### COMP peripheral Extended features  #####
13   ==============================================================================
14
15   [..] Comparing to other previous devices, the COMP interface for STM32L0XX
16        devices contains the following additional features
17
18        (+) Possibility to enable or disable the VREFINT which is used as input
19            to the comparator.
20
21
22   @endverbatim
23   ******************************************************************************
24   * @attention
25   *
26   * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
27   *
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.
38   *
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.
49   *
50   ******************************************************************************
51   */ 
52
53 /* Includes ------------------------------------------------------------------*/
54 #include "stm32l0xx_hal.h"
55
56 /** @addtogroup STM32L0xx_HAL_Driver
57   * @{
58   */
59
60 /** @addtogroup COMPEx
61   * @brief Extended COMP HAL module driver
62   * @{
63   */
64
65 #ifdef HAL_COMP_MODULE_ENABLED
66
67
68 /** @addtogroup COMPEx_Exported_Functions
69   * @{
70   */
71
72 /** @addtogroup COMPEx_Exported_Functions_Group1
73   * @brief  Extended functions to manage VREFINT for the comparator
74   *
75   * @{
76   */
77
78 /**
79   * @brief  Enables the Buffer Vrefint for the COMP.
80   * @note   This is functional only if the LOCK bit is not set
81
82   * @retval None
83   */
84 void HAL_COMPEx_EnableVREFINT(void)
85 {
86     /* Enable the Buffer for the COMP by setting EN_VREFINT bit and the ENBUFLP_VREFINT_COMP in the CFGR3 register */
87
88     SYSCFG->CFGR3 |= (SYSCFG_CFGR3_ENBUFLP_VREFINT_COMP | SYSCFG_CFGR3_EN_VREFINT);
89 }
90
91 /**
92   * @brief  Disables the Buffer Vrefint for the COMP.
93   * @note   This is functional only if the LOCK bit is not set
94   * @retval None
95   */
96 void HAL_COMPEx_DisableVREFINT(void)
97 {
98     /* Disable the Vrefint by resetting ENBUFLP_BGAP_COMP bit and the EN_VREFINT bit in the CFGR3 register */
99
100     SYSCFG->CFGR3 &= (uint32_t)~((uint32_t)(SYSCFG_CFGR3_ENBUFLP_VREFINT_COMP | SYSCFG_CFGR3_EN_VREFINT));
101 }
102
103 /**
104   * @}
105   */
106
107 /**
108   * @}
109   */
110
111
112 #endif /* HAL_COMP_MODULE_ENABLED */
113 /**
114   * @}
115   */ 
116
117 /**
118   * @}
119   */ 
120 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/