269 uint32_t comp_voltage_scaler_initialized;
270 __IO uint32_t wait_loop_index = 0UL;
271 HAL_StatusTypeDef status =
HAL_OK;
278 else if(__HAL_COMP_IS_LOCKED(hcomp))
286 assert_param(IS_COMP_INPUT_PLUS(hcomp->Instance, hcomp->Init.NonInvertingInput));
287 assert_param(IS_COMP_INPUT_MINUS(hcomp->Instance, hcomp->Init.InvertingInput));
290 assert_param(IS_COMP_HYSTERESIS(hcomp->Init.Hysteresis));
291 assert_param(IS_COMP_BLANKINGSRC_INSTANCE(hcomp->Instance, hcomp->Init.BlankingSrce));
292 assert_param(IS_COMP_TRIGGERMODE(hcomp->Init.TriggerMode));
294 assert_param(IS_COMP_WINDOWMODE(hcomp->Init.WindowMode));
303 COMP_CLEAR_ERRORCODE(hcomp);
314 __HAL_RCC_SYSCFG_CLK_ENABLE();
316 #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1) 320 if (hcomp->MspInitCallback == NULL)
326 hcomp->MspInitCallback(hcomp);
334 comp_voltage_scaler_initialized = READ_BIT(hcomp->Instance->CSR, COMP_CSR_SCALEN);
337 tmp_csr = ( hcomp->Init.NonInvertingInput
338 | hcomp->Init.InvertingInput
339 | hcomp->Init.BlankingSrce
340 | hcomp->Init.Hysteresis
341 | hcomp->Init.OutputPol
347 #if defined (COMP_CSR_INMESEL) 348 #if defined (COMP_CSR_WINMODE) 350 COMP_CSR_PWRMODE | COMP_CSR_INMSEL | COMP_CSR_INPSEL |
351 COMP_CSR_WINMODE | COMP_CSR_POLARITY | COMP_CSR_HYST |
352 COMP_CSR_BLANKING | COMP_CSR_BRGEN | COMP_CSR_SCALEN | COMP_CSR_INMESEL,
357 COMP_CSR_PWRMODE | COMP_CSR_INMSEL | COMP_CSR_INPSEL |
358 COMP_CSR_POLARITY | COMP_CSR_HYST |
359 COMP_CSR_BLANKING | COMP_CSR_BRGEN | COMP_CSR_SCALEN | COMP_CSR_INMESEL,
365 COMP_CSR_PWRMODE | COMP_CSR_INMSEL | COMP_CSR_INPSEL |
366 COMP_CSR_WINMODE | COMP_CSR_POLARITY | COMP_CSR_HYST |
367 COMP_CSR_BLANKING | COMP_CSR_BRGEN | COMP_CSR_SCALEN,
377 if(hcomp->Init.WindowMode == COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON)
379 SET_BIT(COMP12_COMMON->CSR, COMP_CSR_WINMODE);
383 CLEAR_BIT(COMP12_COMMON->CSR, COMP_CSR_WINMODE);
389 if ((READ_BIT(hcomp->Instance->CSR, COMP_CSR_SCALEN) != 0UL) &&
390 (comp_voltage_scaler_initialized == 0UL) )
396 wait_loop_index = ((COMP_DELAY_VOLTAGE_SCALER_STAB_US / 10UL) * (SystemCoreClock / (100000UL * 2UL)));
397 while(wait_loop_index != 0UL)
404 exti_line = COMP_GET_EXTI_LINE(hcomp->Instance);
407 if((hcomp->Init.TriggerMode & (COMP_EXTI_IT | COMP_EXTI_EVENT)) != 0UL)
410 if((hcomp->Init.TriggerMode & COMP_EXTI_RISING) != 0UL)
420 if((hcomp->Init.TriggerMode & COMP_EXTI_FALLING) != 0UL)
433 if((hcomp->Init.TriggerMode & COMP_EXTI_EVENT) != 0UL)
443 if((hcomp->Init.TriggerMode & COMP_EXTI_IT) != 0UL)
__STATIC_INLINE void LL_EXTI_DisableEvent_0_31(uint32_t ExtiLine)
Disable ExtiLine Event request for Lines in range 0 to 31 EMR1 EMx LL_EXTI_DisableEvent_0_31.
__STATIC_INLINE void LL_EXTI_DisableFallingTrig_0_31(uint32_t ExtiLine)
Disable ExtiLine Falling Edge Trigger for Lines in range 0 to 31.
__STATIC_INLINE void LL_EXTI_EnableFallingTrig_0_31(uint32_t ExtiLine)
Enable ExtiLine Falling Edge Trigger for Lines in range 0 to 31.
__STATIC_INLINE void LL_EXTI_EnableRisingTrig_0_31(uint32_t ExtiLine)
Enable ExtiLine Rising Edge Trigger for Lines in range 0 to 31.
__STATIC_INLINE void LL_EXTI_ClearFlag_0_31(uint32_t ExtiLine)
Clear ExtLine Flags for Lines in range 0 to 31.
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
__STATIC_INLINE void LL_EXTI_EnableEvent_0_31(uint32_t ExtiLine)
Enable ExtiLine Event request for Lines in range 0 to 31 EMR1 EMx LL_EXTI_EnableEvent_0_31.
__STATIC_INLINE void LL_EXTI_DisableRisingTrig_0_31(uint32_t ExtiLine)
Disable ExtiLine Rising Edge Trigger for Lines in range 0 to 31.
__STATIC_INLINE void LL_EXTI_DisableIT_0_31(uint32_t ExtiLine)
Disable ExtiLine Interrupt request for Lines in range 0 to 31.
void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp)
Initialize the COMP MSP.
__STATIC_INLINE void LL_EXTI_EnableIT_0_31(uint32_t ExtiLine)
Enable ExtiLine Interrupt request for Lines in range 0 to 31.
void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp)
Comparator trigger callback.
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))