SHIO
Fork of mbed-stm32l0/l1-src by
targets/cmsis/TARGET_STM/TARGET_STM32L0/stm32l0xx_hal_comp_ex.c@638:56887a2974b9, 2016-09-08 (annotated)
- Committer:
- lzbpli
- Date:
- Thu Sep 08 02:46:37 2016 +0000
- Revision:
- 638:56887a2974b9
- Parent:
- 489:119543c9f674
????
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 489:119543c9f674 | 1 | /** |
mbed_official | 489:119543c9f674 | 2 | ****************************************************************************** |
mbed_official | 489:119543c9f674 | 3 | * @file stm32l0xx_hal_comp_ex.c |
mbed_official | 489:119543c9f674 | 4 | * @author MCD Application Team |
mbed_official | 489:119543c9f674 | 5 | * @version V1.2.0 |
mbed_official | 489:119543c9f674 | 6 | * @date 06-February-2015 |
mbed_official | 489:119543c9f674 | 7 | * @brief Extended COMP HAL module driver. |
mbed_official | 489:119543c9f674 | 8 | * @brief This file provides firmware functions to manage the VREFINT |
mbed_official | 489:119543c9f674 | 9 | * which can act as input to the comparator. |
mbed_official | 489:119543c9f674 | 10 | @verbatim |
mbed_official | 489:119543c9f674 | 11 | ============================================================================== |
mbed_official | 489:119543c9f674 | 12 | ##### COMP peripheral Extended features ##### |
mbed_official | 489:119543c9f674 | 13 | ============================================================================== |
mbed_official | 489:119543c9f674 | 14 | |
mbed_official | 489:119543c9f674 | 15 | [..] Comparing to other previous devices, the COMP interface for STM32L0XX |
mbed_official | 489:119543c9f674 | 16 | devices contains the following additional features |
mbed_official | 489:119543c9f674 | 17 | |
mbed_official | 489:119543c9f674 | 18 | (+) Possibility to enable or disable the VREFINT which is used as input |
mbed_official | 489:119543c9f674 | 19 | to the comparator. |
mbed_official | 489:119543c9f674 | 20 | |
mbed_official | 489:119543c9f674 | 21 | |
mbed_official | 489:119543c9f674 | 22 | @endverbatim |
mbed_official | 489:119543c9f674 | 23 | ****************************************************************************** |
mbed_official | 489:119543c9f674 | 24 | * @attention |
mbed_official | 489:119543c9f674 | 25 | * |
mbed_official | 489:119543c9f674 | 26 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
mbed_official | 489:119543c9f674 | 27 | * |
mbed_official | 489:119543c9f674 | 28 | * Redistribution and use in source and binary forms, with or without modification, |
mbed_official | 489:119543c9f674 | 29 | * are permitted provided that the following conditions are met: |
mbed_official | 489:119543c9f674 | 30 | * 1. Redistributions of source code must retain the above copyright notice, |
mbed_official | 489:119543c9f674 | 31 | * this list of conditions and the following disclaimer. |
mbed_official | 489:119543c9f674 | 32 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
mbed_official | 489:119543c9f674 | 33 | * this list of conditions and the following disclaimer in the documentation |
mbed_official | 489:119543c9f674 | 34 | * and/or other materials provided with the distribution. |
mbed_official | 489:119543c9f674 | 35 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
mbed_official | 489:119543c9f674 | 36 | * may be used to endorse or promote products derived from this software |
mbed_official | 489:119543c9f674 | 37 | * without specific prior written permission. |
mbed_official | 489:119543c9f674 | 38 | * |
mbed_official | 489:119543c9f674 | 39 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
mbed_official | 489:119543c9f674 | 40 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
mbed_official | 489:119543c9f674 | 41 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
mbed_official | 489:119543c9f674 | 42 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
mbed_official | 489:119543c9f674 | 43 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
mbed_official | 489:119543c9f674 | 44 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
mbed_official | 489:119543c9f674 | 45 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
mbed_official | 489:119543c9f674 | 46 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
mbed_official | 489:119543c9f674 | 47 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
mbed_official | 489:119543c9f674 | 48 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
mbed_official | 489:119543c9f674 | 49 | * |
mbed_official | 489:119543c9f674 | 50 | ****************************************************************************** |
mbed_official | 489:119543c9f674 | 51 | */ |
mbed_official | 489:119543c9f674 | 52 | |
mbed_official | 489:119543c9f674 | 53 | /* Includes ------------------------------------------------------------------*/ |
mbed_official | 489:119543c9f674 | 54 | #include "stm32l0xx_hal.h" |
mbed_official | 489:119543c9f674 | 55 | |
mbed_official | 489:119543c9f674 | 56 | /** @addtogroup STM32L0xx_HAL_Driver |
mbed_official | 489:119543c9f674 | 57 | * @{ |
mbed_official | 489:119543c9f674 | 58 | */ |
mbed_official | 489:119543c9f674 | 59 | |
mbed_official | 489:119543c9f674 | 60 | /** @addtogroup COMPEx |
mbed_official | 489:119543c9f674 | 61 | * @brief Extended COMP HAL module driver |
mbed_official | 489:119543c9f674 | 62 | * @{ |
mbed_official | 489:119543c9f674 | 63 | */ |
mbed_official | 489:119543c9f674 | 64 | |
mbed_official | 489:119543c9f674 | 65 | #ifdef HAL_COMP_MODULE_ENABLED |
mbed_official | 489:119543c9f674 | 66 | |
mbed_official | 489:119543c9f674 | 67 | |
mbed_official | 489:119543c9f674 | 68 | /** @addtogroup COMPEx_Exported_Functions |
mbed_official | 489:119543c9f674 | 69 | * @{ |
mbed_official | 489:119543c9f674 | 70 | */ |
mbed_official | 489:119543c9f674 | 71 | |
mbed_official | 489:119543c9f674 | 72 | /** @addtogroup COMPEx_Exported_Functions_Group1 |
mbed_official | 489:119543c9f674 | 73 | * @brief Extended functions to manage VREFINT for the comparator |
mbed_official | 489:119543c9f674 | 74 | * |
mbed_official | 489:119543c9f674 | 75 | * @{ |
mbed_official | 489:119543c9f674 | 76 | */ |
mbed_official | 489:119543c9f674 | 77 | |
mbed_official | 489:119543c9f674 | 78 | /** |
mbed_official | 489:119543c9f674 | 79 | * @brief Enables the Buffer Vrefint for the COMP. |
mbed_official | 489:119543c9f674 | 80 | * @note This is functional only if the LOCK bit is not set |
mbed_official | 489:119543c9f674 | 81 | |
mbed_official | 489:119543c9f674 | 82 | * @retval None |
mbed_official | 489:119543c9f674 | 83 | */ |
mbed_official | 489:119543c9f674 | 84 | void HAL_COMPEx_EnableVREFINT(void) |
mbed_official | 489:119543c9f674 | 85 | { |
mbed_official | 489:119543c9f674 | 86 | /* Enable the Buffer for the COMP by setting EN_VREFINT bit and the ENBUFLP_VREFINT_COMP in the CFGR3 register */ |
mbed_official | 489:119543c9f674 | 87 | |
mbed_official | 489:119543c9f674 | 88 | SYSCFG->CFGR3 |= (SYSCFG_CFGR3_ENBUFLP_VREFINT_COMP | SYSCFG_CFGR3_EN_VREFINT); |
mbed_official | 489:119543c9f674 | 89 | } |
mbed_official | 489:119543c9f674 | 90 | |
mbed_official | 489:119543c9f674 | 91 | /** |
mbed_official | 489:119543c9f674 | 92 | * @brief Disables the Buffer Vrefint for the COMP. |
mbed_official | 489:119543c9f674 | 93 | * @note This is functional only if the LOCK bit is not set |
mbed_official | 489:119543c9f674 | 94 | * @retval None |
mbed_official | 489:119543c9f674 | 95 | */ |
mbed_official | 489:119543c9f674 | 96 | void HAL_COMPEx_DisableVREFINT(void) |
mbed_official | 489:119543c9f674 | 97 | { |
mbed_official | 489:119543c9f674 | 98 | /* Disable the Vrefint by resetting ENBUFLP_BGAP_COMP bit and the EN_VREFINT bit in the CFGR3 register */ |
mbed_official | 489:119543c9f674 | 99 | |
mbed_official | 489:119543c9f674 | 100 | SYSCFG->CFGR3 &= (uint32_t)~((uint32_t)(SYSCFG_CFGR3_ENBUFLP_VREFINT_COMP | SYSCFG_CFGR3_EN_VREFINT)); |
mbed_official | 489:119543c9f674 | 101 | } |
mbed_official | 489:119543c9f674 | 102 | |
mbed_official | 489:119543c9f674 | 103 | /** |
mbed_official | 489:119543c9f674 | 104 | * @} |
mbed_official | 489:119543c9f674 | 105 | */ |
mbed_official | 489:119543c9f674 | 106 | |
mbed_official | 489:119543c9f674 | 107 | /** |
mbed_official | 489:119543c9f674 | 108 | * @} |
mbed_official | 489:119543c9f674 | 109 | */ |
mbed_official | 489:119543c9f674 | 110 | |
mbed_official | 489:119543c9f674 | 111 | |
mbed_official | 489:119543c9f674 | 112 | #endif /* HAL_COMP_MODULE_ENABLED */ |
mbed_official | 489:119543c9f674 | 113 | /** |
mbed_official | 489:119543c9f674 | 114 | * @} |
mbed_official | 489:119543c9f674 | 115 | */ |
mbed_official | 489:119543c9f674 | 116 | |
mbed_official | 489:119543c9f674 | 117 | /** |
mbed_official | 489:119543c9f674 | 118 | * @} |
mbed_official | 489:119543c9f674 | 119 | */ |
mbed_official | 489:119543c9f674 | 120 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |