/* Initializes the COMP peripheral according to the specified parameters in COMP_InitStruct.  */
void COMP_Init(uint32_t COMP_Selection, COMP_InitTypeDef *COMP_InitStruct)
/* Initializes the COMP peripheral according to the specified parameters in COMP_InitStruct.  */
void COMP_Init(uint32_t COMP_Selection, COMP_InitTypeDef *COMP_InitStruct)
{
  uint32_t tmpreg = 0;
  assert_param(IS_COMP_ALL_PERIPH(COMP_Selection));
  assert_param(IS_COMP_INVERTING_INPUT(COMP_InitStruct->COMP_InvertingInput));
  assert_param(IS_COMP_OUTPUT(COMP_InitStruct->COMP_Output));
  assert_param(IS_COMP_OUTPUT_POL(COMP_InitStruct->COMP_OutputPol));
  assert_param(IS_COMP_HYSTERESIS(COMP_InitStruct->COMP_Hysteresis));
  assert_param(IS_COMP_MODE(COMP_InitStruct->COMP_Mode));
  tmpreg = COMP->CSR; 
  tmpreg &= (uint32_t) ~(COMP_CSR_CLEAR_MASK<<COMP_Selection);   
  tmpreg |= (uint32_t)((COMP_InitStruct->COMP_InvertingInput | COMP_InitStruct->COMP_Output |
                       COMP_InitStruct->COMP_OutputPol | COMP_InitStruct->COMP_Hysteresis |
                       COMP_InitStruct->COMP_Mode)<<COMP_Selection);
  COMP->CSR = tmpreg;  
}