亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? stm32l1xx_comp.c

?? STM32+Grlib
?? C
字號:
/**
  ******************************************************************************
  * @file    stm32l1xx_comp.c
  * @author  MCD Application Team
  * @version V1.0.0
  * @date    31-December-2010
  * @brief   This file provides firmware functions to manage the following 
  *          functionalities of the comparators (COMP1 and COMP2) peripheral: 
  *           - Comparators configuration
  *           - Window mode control
  *           - Internal Reference Voltage (VREFINT) output
  *
  *  @verbatim
  *
  *          ===================================================================
  *                                 How to use this driver
  *          ===================================================================
  *                 
  *          The device integrates two analog comparators COMP1 and COMP2:            
  *             - COMP1 is a fixed threshold (VREFINT) that shares the non inverting
  *               input with the ADC channels.
  *
  *             - COMP2 is a rail-to-rail comparator whose the inverting input 
  *               can be selected among: DAC_OUT1, DAC_OUT2, 1/4 VREFINT,
  *               1/2 VERFINT, 3/4 VREFINT, VREFINT, PB3 and whose the output
  *               can be redirected to embedded timers: TIM2, TIM3, TIM4, TIM10
  *
  *             - The two comparators COMP1 and COMP2 can be combined in window
  *               mode.
  *
  * @note
  *          1- Comparator APB clock must be enabled to get write access
  *             to comparator register using
  *             RCC_APB1PeriphClockCmd(RCC_APB1Periph_COMP, ENABLE);
  *
  *          2- COMP1 comparator and ADC can't be used at the same time since
  *             they share the same ADC switch matrix (analog switches).
  *
  *          3- When an I/O is used as comparator input, the corresponding GPIO 
  *             registers should be configured in analog mode.
  *
  *          4- Comparators outputs (CMP1OUT and CMP2OUT) are not mapped on
  *             GPIO pin. They are only internal.
  *             To get the comparator output level, use COMP_GetOutputLevel()
  *
  *          5- COMP1 and COMP2 outputs are internally connected to EXTI Line 21
  *             and EXTI Line 22 respectively.
  *             Interrupts can be used by configuring the EXTI Line using the 
  *             EXTI peripheral driver.
  *
  *          6- After enabling the comparator (COMP1 or COMP2), user should wait
  *             for start-up time (tSTART) to get right output levels.
  *             Please refer to product datasheet for more information on tSTART.  
  *
  *          7- Comparators cannot be used to exit the device from Sleep or Stop 
  *             mode when the internal reference voltage is switched off using 
  *             the PWR_UltraLowPowerCmd() function (ULP bit in the PWR_CR register).
  *
  *  @endverbatim
  *    
  ******************************************************************************
  * @attention
  *
  * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
  * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
  * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
  * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
  * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
  * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
  *
  * <h2><center>&copy; COPYRIGHT 2010 STMicroelectronics</center></h2>
  ******************************************************************************  
  */ 

/* Includes ------------------------------------------------------------------*/
#include "stm32l1xx_comp.h"

/** @addtogroup STM32L1xx_StdPeriph_Driver
  * @{
  */

/** @defgroup COMP 
  * @brief COMP driver modules
  * @{
  */ 

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/

/** @defgroup COMP_Private_Functions
  * @{
  */

/** @defgroup COMP_Group1 Initialization and Configuration functions
 *  @brief   Initialization and Configuration functions 
 *
@verbatim   
 ===============================================================================
                        Initialization and Configuration functions
 ===============================================================================  

@endverbatim
  * @{
  */
   
/**
  * @brief  Deinitializes COMP peripheral registers to their default reset values.
  * @param  None
  * @retval None
  */
void COMP_DeInit(void)
{
  COMP->CSR = ((uint32_t)0x00000000);    /*!< Set COMP->CSR to reset value */
}

/**
  * @brief  Initializes the COMP2 peripheral according to the specified parameters
  *         in the COMP_InitStruct:
  *           - COMP_InvertingInput specify the inverting input of COMP2
  *           - COMP_OutputSelect connect the output of COMP2 to selected timer
  *             input (Input capture / Output Compare Reference Clear)
  *           - COMP_Speed configures COMP2 speed for optimum speed/consumption ratio
  * @note   This function configures only COMP2.
  * @note   COMP2 comparator is enabled as soon as the INSEL[2:0] bits are 
  *         different from "000".
  * @param  COMP_InitStruct: pointer to an COMP_InitTypeDef structure that contains 
  *         the configuration information for the specified COMP peripheral.
  * @retval None
  */
void COMP_Init(COMP_InitTypeDef* COMP_InitStruct)
{
  uint32_t tmpreg = 0;
  
  /* Check the parameters */
  assert_param(IS_COMP_INVERTING_INPUT(COMP_InitStruct->COMP_InvertingInput));
  assert_param(IS_COMP_OUTPUT(COMP_InitStruct->COMP_OutputSelect));
  assert_param(IS_COMP_SPEED(COMP_InitStruct->COMP_Speed));

  /*!< Get the COMP CSR value */
  tmpreg = COMP->CSR;

  /*!< Clear the  INSEL[2:0], OUTSEL[1:0] and SPEED bits */ 
  tmpreg &= (uint32_t) (~(uint32_t) (COMP_CSR_OUTSEL | COMP_CSR_INSEL | COMP_CSR_SPEED));
  
  /*!< Configure COMP: speed, inversion input selection and output redirection */
  /*!< Set SPEED bit according to COMP_InitStruct->COMP_Speed value */
  /*!< Set INSEL bits according to COMP_InitStruct->COMP_InvertingInput value */ 
  /*!< Set OUTSEL bits according to COMP_InitStruct->COMP_OutputSelect value */  
  tmpreg |= (uint32_t)((COMP_InitStruct->COMP_Speed | COMP_InitStruct->COMP_InvertingInput 
                        | COMP_InitStruct->COMP_OutputSelect));

  /*!< The COMP2 comparator is enabled as soon as the INSEL[2:0] bits value are 
     different from "000" */
  /*!< Write to COMP_CSR register */
  COMP->CSR = tmpreg;  
}

/**
  * @brief  Enable or disable the COMP1 peripheral.
  *         After enabling COMP1, the following functions should be called to 
  *         connect the selected GPIO input to COMP1 non inverting input:
  *          - Enable switch control mode using SYSCFG_RISwitchControlModeCmd()
  *          - Close VCOMP switch using SYSCFG_RIIOSwitchConfig()
  *          - Close the I/O switch number n corresponding to the I/O 
  *            using SYSCFG_RIIOSwitchConfig()
  * @param  NewState: new state of the COMP1 peripheral.
  *         This parameter can be: ENABLE or DISABLE.
  * @note   This function enables/disables only the COMP1.
  * @retval None
  */
void COMP_Cmd(FunctionalState NewState)
{
  /* Check the parameter */
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    /* Enable the COMP1 */
    COMP->CSR |= (uint32_t) COMP_CSR_CMP1EN;
  }
  else
  {
    /* Disable the COMP1  */
    COMP->CSR &= (uint32_t)(~COMP_CSR_CMP1EN);
  }
}

/**
  * @brief  Return the output level (high or low) of the selected comparator:
  *         - Comparator output is low when the non-inverting input is at a lower
  *           voltage than the inverting input
  *         - Comparator output is high when the non-inverting input is at a higher
  *           voltage than the inverting input
  * @note   Comparators outputs aren't available on GPIO (outputs levels are 
  *         only internal). The COMP1 and COMP2 outputs are connected internally 
  *         to the EXTI Line 21 and Line 22 respectively.  
  * @param  COMP_Selection: the selected comparator. 
  *   This parameter can be one of the following values:
  *     @arg COMP_Selection_COMP1: COMP1 selected
  *     @arg COMP_Selection_COMP2: COMP2 selected  
  * @retval Returns the selected comparator output level.
  */
uint8_t COMP_GetOutputLevel(uint32_t COMP_Selection)
{
  uint8_t compout = 0x0;

  /* Check the parameters */
  assert_param(IS_COMP_ALL_PERIPH(COMP_Selection));

  /* Check if Comparator 1 is selected */
  if(COMP_Selection == COMP_Selection_COMP1)
  {
    /* Check if comparator 1 output level is high */
    if((COMP->CSR & COMP_CSR_CMP1OUT) != (uint8_t) RESET)
    {
      /* Get Comparator 1 output level */
      compout = (uint8_t) COMP_OutputLevel_High;
    }
    /* comparator 1 output level is low */
    else
    {
      /* Get Comparator 1 output level */
      compout = (uint8_t) COMP_OutputLevel_Low;
    }
  }
  /* Comparator 2 is selected */
  else
  {
    /* Check if comparator 2 output level is high */
    if((COMP->CSR & COMP_CSR_CMP2OUT) != (uint8_t) RESET)
    {
      /* Get Comparator output level */
      compout = (uint8_t) COMP_OutputLevel_High;
    }
    /* comparator 2 output level is low */
    else
    {
      /* Get Comparator 2 output level */
      compout = (uint8_t) COMP_OutputLevel_Low;
    }
  }
  /* Return the comparator output level */
  return (uint8_t)(compout);
}

/**
  * @}
  */

/** @defgroup COMP_Group2 Window mode control function
 *  @brief   Window mode control function 
 *
@verbatim   
 ===============================================================================
                              Window mode control function
 ===============================================================================  

@endverbatim
  * @{
  */

/**
  * @brief  Enables or disables the window mode.
  *         In window mode:
  *          - COMP1 inverting input is fixed to VREFINT defining the first
  *            threshold
  *          - COMP2 inverting input is configurable (DAC_OUT1, DAC_OUT2, VREFINT
  *            sub-multiples, PB3) defining the second threshold
  *          - COMP1 and COMP2 non inverting inputs are connected together.
  * @note   In window mode, only the Group 6 (PB4 or PB5) can be used as
  *         non-inverting inputs.
  * param   NewState: new state of the window mode. 
  *   This parameter can be ENABLE or DISABLE.
  * @retval None
  */
void COMP_WindowCmd(FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_FUNCTIONAL_STATE(NewState));
  
  if (NewState != DISABLE)
  {
    /* Enable the window mode */
    COMP->CSR |= (uint32_t) COMP_CSR_WNDWE;
  }
  else
  {
    /* Disable the window mode */
    COMP->CSR &= (uint32_t)(~COMP_CSR_WNDWE);
  }
}

/**
  * @}
  */

/** @defgroup COMP_Group3 Internal Reference Voltage output function
 *  @brief   Internal Reference Voltage (VREFINT) output function 
 *
@verbatim   
 ===============================================================================
             Internal Reference Voltage (VREFINT) output function
 ===============================================================================  

@endverbatim
  * @{
  */

/**
  * @brief  Enables or disables the output of internal reference voltage (VREFINT).
  *         The VREFINT output can be routed to any I/O in group 3: CH8 (PB0) or
  *         CH9 (PB1).
  *         To correctly use this function, the SYSCFG_RIIOSwitchConfig() function
  *         should be called after.
  * @param  NewState: new state of the Vrefint output.
  *         This parameter can be: ENABLE or DISABLE.
  * @retval None
  */
void COMP_VrefintOutputCmd(FunctionalState NewState)
{
  /* Check the parameters */
  assert_param(IS_FUNCTIONAL_STATE(NewState));

  if (NewState != DISABLE)
  {
    /* Enable the output of internal reference voltage */
    COMP->CSR |= (uint32_t) COMP_CSR_VREFOUTEN;
  }
  else
  {
    /* Disable the output of internal reference voltage */
    COMP->CSR &= (uint32_t) (~COMP_CSR_VREFOUTEN);
  }
}

/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

/**
  * @}
  */

/******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
性做久久久久久免费观看| 欧美日韩高清一区二区| 欧美日韩综合色| 欧美韩国一区二区| 国内久久精品视频| 欧美一区国产二区| 亚洲风情在线资源站| 99精品国产99久久久久久白柏| 日韩亚洲欧美在线| 亚洲成人免费av| 在线观看日韩高清av| 成人欧美一区二区三区黑人麻豆| 久久av老司机精品网站导航| 在线观看亚洲精品视频| 最新日韩av在线| 大胆亚洲人体视频| 国产欧美综合在线观看第十页| 韩国av一区二区三区在线观看 | 三级亚洲高清视频| 色综合久久中文综合久久牛| 国产精品久线在线观看| 粉嫩aⅴ一区二区三区四区| 精品国产成人在线影院 | 欧美乱妇23p| 一级做a爱片久久| 色哟哟国产精品| 亚洲欧美日韩在线| 91论坛在线播放| 亚洲女人****多毛耸耸8| 91麻豆免费观看| 亚洲最新视频在线观看| 91黄色激情网站| 一区二区免费视频| 欧美老肥妇做.爰bbww视频| 亚洲成av人片在线观看| 在线不卡a资源高清| 美美哒免费高清在线观看视频一区二区| 欧美猛男超大videosgay| 亚洲.国产.中文慕字在线| 宅男噜噜噜66一区二区66| 蜜臀91精品一区二区三区| 日韩欧美一二区| 国产一区二区免费看| 国产精品丝袜久久久久久app| 国产一区视频网站| 亚洲欧洲日韩女同| 欧美色图一区二区三区| 五月天激情综合| 久久综合九色综合97_久久久| 国产成人欧美日韩在线电影| 中文字幕亚洲成人| 欧美老肥妇做.爰bbww| 美女在线视频一区| 欧美国产精品中文字幕| 91麻豆国产在线观看| 亚洲动漫第一页| 亚洲精品在线免费观看视频| 成人听书哪个软件好| 亚洲黄色av一区| 欧美第一区第二区| 99这里都是精品| 视频一区国产视频| 国产精品美女久久久久久| 欧美日韩大陆在线| 国产福利视频一区二区三区| 一区二区三区蜜桃网| 久久中文娱乐网| 欧美性猛交xxxx黑人交| 国产成人夜色高潮福利影视| 亚洲成人福利片| 国产精品乱码一区二三区小蝌蚪| 欧美性xxxxxx少妇| 国产激情视频一区二区在线观看| 亚洲精品中文字幕乱码三区| xnxx国产精品| 6080午夜不卡| 91视频免费看| 国产福利91精品一区二区三区| 亚洲h精品动漫在线观看| 国产女人aaa级久久久级| 欧美剧在线免费观看网站| 99re在线精品| 国产一区二区三区四区在线观看| 亚洲综合区在线| 国产精品久久久久久久岛一牛影视| 欧美日韩大陆一区二区| 91免费国产在线观看| 黄色日韩网站视频| 日韩电影在线观看网站| 一片黄亚洲嫩模| 17c精品麻豆一区二区免费| 久久久久久久综合| 日韩视频在线永久播放| 欧美三级日本三级少妇99| 99久久精品久久久久久清纯| 国产一区二区日韩精品| 理论片日本一区| 日本亚洲天堂网| 天天综合色天天| 日韩精品成人一区二区在线| 亚洲综合网站在线观看| 亚洲精品高清在线观看| 综合色中文字幕| 最新欧美精品一区二区三区| 国产精品久久午夜| 国产精品网站在线观看| 国产无遮挡一区二区三区毛片日本| 欧美一卡2卡3卡4卡| 欧美一区二区视频在线观看2022 | 免费在线观看视频一区| 午夜精品久久久久久久| 亚洲国产视频a| 午夜精品久久久久久久久久久 | 日韩一区二区在线观看| 欧美日韩视频在线一区二区| 欧美日韩一级二级| 51精品国自产在线| 日韩精品中文字幕一区| 欧美大片拔萝卜| 久久影院视频免费| 中文字幕+乱码+中文字幕一区| 国产精品美女久久久久av爽李琼| 国产精品人成在线观看免费| 中文字幕日韩精品一区| 亚洲欧洲中文日韩久久av乱码| 亚洲男人的天堂av| 亚洲成人中文在线| 久久黄色级2电影| 国产91在线|亚洲| 色偷偷成人一区二区三区91| 91久久国产综合久久| 91麻豆精品国产91久久久使用方法| 日韩精品一区在线观看| 中文字幕av一区二区三区高| 亚洲欧美激情一区二区| 五月激情综合色| 国产一区二区成人久久免费影院| 成人黄动漫网站免费app| 欧美性videosxxxxx| 精品国产a毛片| 一区精品在线播放| 秋霞午夜鲁丝一区二区老狼| 风间由美一区二区三区在线观看 | 亚洲一区二区三区四区五区黄| 亚洲午夜激情网页| 韩国一区二区在线观看| 91美女片黄在线观看91美女| 日韩小视频在线观看专区| 欧美激情资源网| 日韩有码一区二区三区| 成人av电影免费在线播放| 欧美精品 日韩| 国产精品福利影院| 久久精品国产一区二区三| 91亚洲永久精品| 精品国产123| 亚洲午夜免费电影| 国产福利一区二区三区视频| 欧美日韩国产片| 国产精品伦理一区二区| 蜜臀久久99精品久久久久久9| gogo大胆日本视频一区| 精品国产免费一区二区三区四区| 自拍偷拍国产精品| 国产在线播放一区| 69堂国产成人免费视频| 亚洲人成7777| 成人免费视频caoporn| 日韩免费电影一区| 亚洲国产日韩a在线播放| eeuss鲁片一区二区三区在线看| 日韩欧美成人一区二区| 五月婷婷久久综合| 91天堂素人约啪| 国产精品久久久久久久久免费桃花 | 日韩午夜激情视频| 亚洲国产视频a| 色狠狠一区二区| 亚洲欧洲日产国产综合网| 国产盗摄精品一区二区三区在线| 欧美日韩色综合| 亚洲午夜激情av| 91久久一区二区| 亚洲日本乱码在线观看| 成人免费毛片嘿嘿连载视频| 久久久久久电影| 国产一区二区三区免费看| 日韩欧美一区在线观看| 性做久久久久久久免费看| 欧美性猛交xxxx乱大交退制版| 依依成人综合视频| 欧美亚洲一区二区在线观看| 一区二区三区日韩欧美精品| 91黄色免费观看| 亚洲国产成人va在线观看天堂| 色婷婷一区二区三区四区| 亚洲自拍偷拍图区| 欧美日韩在线播放三区| 亚洲自拍偷拍九九九| 欧美日韩国产小视频|