Files
@ 89a3a8b7b86f
Branch filter:
Location: therm/libraries/STM32L1xx_StdPeriph_Driver/inc/stm32l1xx_comp.h
89a3a8b7b86f
6.9 KiB
text/plain
updated config interface
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | /**
******************************************************************************
* @file stm32l1xx_comp.h
* @author MCD Application Team
* @version V1.2.0
* @date 22-February-2013
* @brief This file contains all the functions prototypes for the COMP firmware
* library.
******************************************************************************
* @attention
*
* <h2><center>© COPYRIGHT 2013 STMicroelectronics</center></h2>
*
* Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32L1xx_COMP_H
#define __STM32L1xx_COMP_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32l1xx.h"
/** @addtogroup STM32L1xx_StdPeriph_Driver
* @{
*/
/** @addtogroup COMP
* @{
*/
/* Exported types ------------------------------------------------------------*/
/**
* @brief COMP Init structure definition
*/
typedef struct
{
uint32_t COMP_Speed; /*!< Defines the speed of comparator 2.
This parameter can be a value of @ref COMP_Speed */
uint32_t COMP_InvertingInput; /*!< Selects the inverting input of the comparator 2.
This parameter can be a value of @ref COMP_InvertingInput */
uint32_t COMP_OutputSelect; /*!< Selects the output redirection of the comparator 2.
This parameter can be a value of @ref COMP_OutputSelect */
}COMP_InitTypeDef;
/* Exported constants --------------------------------------------------------*/
/** @defgroup COMP_Exported_Constants
* @{
*/
#define COMP_OutputLevel_High ((uint32_t)0x00000001)
#define COMP_OutputLevel_Low ((uint32_t)0x00000000)
/** @defgroup COMP_Selection
* @{
*/
#define COMP_Selection_COMP1 ((uint32_t)0x00000001)
#define COMP_Selection_COMP2 ((uint32_t)0x00000002)
#define IS_COMP_ALL_PERIPH(PERIPH) (((PERIPH) == COMP_Selection_COMP1) || \
((PERIPH) == COMP_Selection_COMP2))
/**
* @}
*/
/** @defgroup COMP_InvertingInput
* @{
*/
#define COMP_InvertingInput_None ((uint32_t)0x00000000) /* COMP2 is disabled when this parameter is selected */
#define COMP_InvertingInput_IO ((uint32_t)0x00040000)
#define COMP_InvertingInput_VREFINT ((uint32_t)0x00080000)
#define COMP_InvertingInput_3_4VREFINT ((uint32_t)0x000C0000)
#define COMP_InvertingInput_1_2VREFINT ((uint32_t)0x00100000)
#define COMP_InvertingInput_1_4VREFINT ((uint32_t)0x00140000)
#define COMP_InvertingInput_DAC1 ((uint32_t)0x00180000)
#define COMP_InvertingInput_DAC2 ((uint32_t)0x001C0000)
#define IS_COMP_INVERTING_INPUT(INPUT) (((INPUT) == COMP_InvertingInput_None) || \
((INPUT) == COMP_InvertingInput_IO) || \
((INPUT) == COMP_InvertingInput_VREFINT) || \
((INPUT) == COMP_InvertingInput_3_4VREFINT) || \
((INPUT) == COMP_InvertingInput_1_2VREFINT) || \
((INPUT) == COMP_InvertingInput_1_4VREFINT) || \
((INPUT) == COMP_InvertingInput_DAC1) || \
((INPUT) == COMP_InvertingInput_DAC2))
/**
* @}
*/
/** @defgroup COMP_OutputSelect
* @{
*/
#define COMP_OutputSelect_TIM2IC4 ((uint32_t)0x00000000)
#define COMP_OutputSelect_TIM2OCREFCLR ((uint32_t)0x00200000)
#define COMP_OutputSelect_TIM3IC4 ((uint32_t)0x00400000)
#define COMP_OutputSelect_TIM3OCREFCLR ((uint32_t)0x00600000)
#define COMP_OutputSelect_TIM4IC4 ((uint32_t)0x00800000)
#define COMP_OutputSelect_TIM4OCREFCLR ((uint32_t)0x00A00000)
#define COMP_OutputSelect_TIM10IC1 ((uint32_t)0x00C00000)
#define COMP_OutputSelect_None ((uint32_t)0x00E00000)
#define IS_COMP_OUTPUT(OUTPUT) (((OUTPUT) == COMP_OutputSelect_TIM2IC4) || \
((OUTPUT) == COMP_OutputSelect_TIM2OCREFCLR) || \
((OUTPUT) == COMP_OutputSelect_TIM3IC4) || \
((OUTPUT) == COMP_OutputSelect_TIM3OCREFCLR) || \
((OUTPUT) == COMP_OutputSelect_TIM4IC4) || \
((OUTPUT) == COMP_OutputSelect_TIM4OCREFCLR) || \
((OUTPUT) == COMP_OutputSelect_TIM10IC1) || \
((OUTPUT) == COMP_OutputSelect_None))
/**
* @}
*/
/** @defgroup COMP_Speed
* @{
*/
#define COMP_Speed_Slow ((uint32_t)0x00000000)
#define COMP_Speed_Fast ((uint32_t)0x00001000)
#define IS_COMP_SPEED(SPEED) (((SPEED) == COMP_Speed_Slow) || \
((SPEED) == COMP_Speed_Fast))
/**
* @}
*/
/**
* @}
*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
/* Function used to set the COMP configuration to the default reset state ****/
void COMP_DeInit(void);
/* Initialization and Configuration functions *********************************/
void COMP_Init(COMP_InitTypeDef* COMP_InitStruct);
void COMP_Cmd(FunctionalState NewState);
uint8_t COMP_GetOutputLevel(uint32_t COMP_Selection);
void COMP_SW1SwitchConfig(FunctionalState NewState);
/* Window mode control function ***********************************************/
void COMP_WindowCmd(FunctionalState NewState);
/* Internal Reference Voltage (VREFINT) output function ***********************/
void COMP_VrefintOutputCmd(FunctionalState NewState);
#ifdef __cplusplus
}
#endif
#endif /*__STM32L1xx_COMP_H */
/**
* @}
*/
/**
* @}
*/
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|