Lines Matching refs:hcomp
233 HAL_StatusTypeDef HAL_COMP_Init(COMP_HandleTypeDef *hcomp) in HAL_COMP_Init() argument
242 if (hcomp == NULL) in HAL_COMP_Init()
246 else if (__HAL_COMP_IS_LOCKED(hcomp)) in HAL_COMP_Init()
253 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_Init()
254 assert_param(IS_COMP_INPUT_PLUS(hcomp->Instance, hcomp->Init.InputPlus)); in HAL_COMP_Init()
255 assert_param(IS_COMP_INPUT_MINUS(hcomp->Instance, hcomp->Init.InputMinus)); in HAL_COMP_Init()
256 assert_param(IS_COMP_OUTPUTPOL(hcomp->Init.OutputPol)); in HAL_COMP_Init()
257 assert_param(IS_COMP_POWERMODE(hcomp->Init.Mode)); in HAL_COMP_Init()
258 assert_param(IS_COMP_HYSTERESIS(hcomp->Init.Hysteresis)); in HAL_COMP_Init()
259 assert_param(IS_COMP_BLANKINGSRCE(hcomp->Init.BlankingSrce)); in HAL_COMP_Init()
260 assert_param(IS_COMP_TRIGGERMODE(hcomp->Init.TriggerMode)); in HAL_COMP_Init()
263 assert_param(IS_COMP_WINDOWMODE(hcomp->Instance, hcomp->Init.WindowMode)); in HAL_COMP_Init()
265 if (hcomp->Init.WindowMode != COMP_WINDOWMODE_DISABLE) in HAL_COMP_Init()
267 assert_param(IS_COMP_WINDOWOUTPUT(hcomp->Init.WindowOutput)); in HAL_COMP_Init()
271 if (hcomp->State == HAL_COMP_STATE_RESET) in HAL_COMP_Init()
274 hcomp->Lock = HAL_UNLOCKED; in HAL_COMP_Init()
277 COMP_CLEAR_ERRORCODE(hcomp); in HAL_COMP_Init()
281 hcomp->TriggerCallback = HAL_COMP_TriggerCallback; /* Legacy weak callback */ in HAL_COMP_Init()
283 if (hcomp->MspInitCallback == NULL) in HAL_COMP_Init()
285 hcomp->MspInitCallback = HAL_COMP_MspInit; /* Legacy weak MspInit */ in HAL_COMP_Init()
292 hcomp->MspInitCallback(hcomp); in HAL_COMP_Init()
298 HAL_COMP_MspInit(hcomp); in HAL_COMP_Init()
303 …comp_voltage_scaler_initialized = READ_BIT(hcomp->Instance->CSR, (COMP_CSR_INMSEL_1 | COMP_CSR_INM… in HAL_COMP_Init()
306 tmp_csr = (hcomp->Init.InputMinus in HAL_COMP_Init()
307 | hcomp->Init.InputPlus in HAL_COMP_Init()
308 | hcomp->Init.BlankingSrce in HAL_COMP_Init()
309 | hcomp->Init.Hysteresis in HAL_COMP_Init()
310 | hcomp->Init.OutputPol in HAL_COMP_Init()
311 | hcomp->Init.Mode in HAL_COMP_Init()
316 MODIFY_REG(hcomp->Instance->CSR, in HAL_COMP_Init()
329 if (hcomp->Init.WindowMode == COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON) in HAL_COMP_Init()
334 else if (hcomp->Init.WindowMode == COMP_WINDOWMODE_COMP2_INPUT_PLUS_COMMON) in HAL_COMP_Init()
349 switch (hcomp->Init.WindowOutput) in HAL_COMP_Init()
375 if ((READ_BIT(hcomp->Instance->CSR, (COMP_CSR_INMSEL_1 | COMP_CSR_INMSEL_0)) != 0UL) && in HAL_COMP_Init()
390 exti_line = COMP_GET_EXTI_LINE(hcomp->Instance); in HAL_COMP_Init()
393 if ((hcomp->Init.TriggerMode & (COMP_EXTI_IT | COMP_EXTI_EVENT)) != 0UL) in HAL_COMP_Init()
396 if ((hcomp->Init.TriggerMode & COMP_EXTI_RISING) != 0UL) in HAL_COMP_Init()
406 if ((hcomp->Init.TriggerMode & COMP_EXTI_FALLING) != 0UL) in HAL_COMP_Init()
420 if ((hcomp->Init.TriggerMode & COMP_EXTI_EVENT) != 0UL) in HAL_COMP_Init()
430 if ((hcomp->Init.TriggerMode & COMP_EXTI_IT) != 0UL) in HAL_COMP_Init()
451 if (hcomp->State == HAL_COMP_STATE_RESET) in HAL_COMP_Init()
453 hcomp->State = HAL_COMP_STATE_READY; in HAL_COMP_Init()
467 HAL_StatusTypeDef HAL_COMP_DeInit(COMP_HandleTypeDef *hcomp) in HAL_COMP_DeInit() argument
472 if (hcomp == NULL) in HAL_COMP_DeInit()
476 else if (__HAL_COMP_IS_LOCKED(hcomp)) in HAL_COMP_DeInit()
483 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_DeInit()
486 WRITE_REG(hcomp->Instance->CSR, 0x00000000UL); in HAL_COMP_DeInit()
489 if (hcomp->MspDeInitCallback == NULL) in HAL_COMP_DeInit()
491 hcomp->MspDeInitCallback = HAL_COMP_MspDeInit; /* Legacy weak MspDeInit */ in HAL_COMP_DeInit()
495 hcomp->MspDeInitCallback(hcomp); in HAL_COMP_DeInit()
498 HAL_COMP_MspDeInit(hcomp); in HAL_COMP_DeInit()
502 hcomp->State = HAL_COMP_STATE_RESET; in HAL_COMP_DeInit()
505 __HAL_UNLOCK(hcomp); in HAL_COMP_DeInit()
516 __weak void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp) in HAL_COMP_MspInit() argument
519 UNUSED(hcomp); in HAL_COMP_MspInit()
531 __weak void HAL_COMP_MspDeInit(COMP_HandleTypeDef *hcomp) in HAL_COMP_MspDeInit() argument
534 UNUSED(hcomp); in HAL_COMP_MspDeInit()
555 HAL_StatusTypeDef HAL_COMP_RegisterCallback(COMP_HandleTypeDef *hcomp, HAL_COMP_CallbackIDTypeDef C… in HAL_COMP_RegisterCallback() argument
563 hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK; in HAL_COMP_RegisterCallback()
568 if (HAL_COMP_STATE_READY == hcomp->State) in HAL_COMP_RegisterCallback()
573 hcomp->TriggerCallback = pCallback; in HAL_COMP_RegisterCallback()
577 hcomp->MspInitCallback = pCallback; in HAL_COMP_RegisterCallback()
581 hcomp->MspDeInitCallback = pCallback; in HAL_COMP_RegisterCallback()
586 hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK; in HAL_COMP_RegisterCallback()
593 else if (HAL_COMP_STATE_RESET == hcomp->State) in HAL_COMP_RegisterCallback()
598 hcomp->MspInitCallback = pCallback; in HAL_COMP_RegisterCallback()
602 hcomp->MspDeInitCallback = pCallback; in HAL_COMP_RegisterCallback()
607 hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK; in HAL_COMP_RegisterCallback()
617 hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK; in HAL_COMP_RegisterCallback()
638 HAL_StatusTypeDef HAL_COMP_UnRegisterCallback(COMP_HandleTypeDef *hcomp, HAL_COMP_CallbackIDTypeDef… in HAL_COMP_UnRegisterCallback() argument
642 if (HAL_COMP_STATE_READY == hcomp->State) in HAL_COMP_UnRegisterCallback()
647 hcomp->TriggerCallback = HAL_COMP_TriggerCallback; /* Legacy weak callback */ in HAL_COMP_UnRegisterCallback()
651 hcomp->MspInitCallback = HAL_COMP_MspInit; /* Legacy weak MspInit */ in HAL_COMP_UnRegisterCallback()
655 hcomp->MspDeInitCallback = HAL_COMP_MspDeInit; /* Legacy weak MspDeInit */ in HAL_COMP_UnRegisterCallback()
660 hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK; in HAL_COMP_UnRegisterCallback()
667 else if (HAL_COMP_STATE_RESET == hcomp->State) in HAL_COMP_UnRegisterCallback()
672 hcomp->MspInitCallback = HAL_COMP_MspInit; /* Legacy weak MspInit */ in HAL_COMP_UnRegisterCallback()
676 hcomp->MspDeInitCallback = HAL_COMP_MspDeInit; /* Legacy weak MspDeInit */ in HAL_COMP_UnRegisterCallback()
681 hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK; in HAL_COMP_UnRegisterCallback()
691 hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK; in HAL_COMP_UnRegisterCallback()
726 HAL_StatusTypeDef HAL_COMP_Start(COMP_HandleTypeDef *hcomp) in HAL_COMP_Start() argument
732 if (hcomp == NULL) in HAL_COMP_Start()
736 else if (__HAL_COMP_IS_LOCKED(hcomp)) in HAL_COMP_Start()
743 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_Start()
745 if (hcomp->State == HAL_COMP_STATE_READY) in HAL_COMP_Start()
748 SET_BIT(hcomp->Instance->CSR, COMP_CSR_EN); in HAL_COMP_Start()
751 hcomp->State = HAL_COMP_STATE_BUSY; in HAL_COMP_Start()
778 HAL_StatusTypeDef HAL_COMP_Stop(COMP_HandleTypeDef *hcomp) in HAL_COMP_Stop() argument
783 if (hcomp == NULL) in HAL_COMP_Stop()
787 else if (__HAL_COMP_IS_LOCKED(hcomp)) in HAL_COMP_Stop()
794 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_Stop()
798 if (hcomp->State != HAL_COMP_STATE_RESET) in HAL_COMP_Stop()
801 CLEAR_BIT(hcomp->Instance->CSR, COMP_CSR_EN); in HAL_COMP_Stop()
804 hcomp->State = HAL_COMP_STATE_READY; in HAL_COMP_Stop()
820 void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp) in HAL_COMP_IRQHandler() argument
823 uint32_t exti_line = COMP_GET_EXTI_LINE(hcomp->Instance); in HAL_COMP_IRQHandler()
825 uint32_t comparator_window_mode = READ_BIT(hcomp->Instance->CSR, COMP_CSR_WINMODE); in HAL_COMP_IRQHandler()
853 hcomp->TriggerCallback(hcomp); in HAL_COMP_IRQHandler()
855 HAL_COMP_TriggerCallback(hcomp); in HAL_COMP_IRQHandler()
882 hcomp->TriggerCallback(hcomp); in HAL_COMP_IRQHandler()
884 HAL_COMP_TriggerCallback(hcomp); in HAL_COMP_IRQHandler()
919 HAL_StatusTypeDef HAL_COMP_Lock(COMP_HandleTypeDef *hcomp) in HAL_COMP_Lock() argument
924 if (hcomp == NULL) in HAL_COMP_Lock()
928 else if (__HAL_COMP_IS_LOCKED(hcomp)) in HAL_COMP_Lock()
935 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_Lock()
938 switch (hcomp->State) in HAL_COMP_Lock()
941 hcomp->State = HAL_COMP_STATE_RESET_LOCKED; in HAL_COMP_Lock()
944 hcomp->State = HAL_COMP_STATE_READY_LOCKED; in HAL_COMP_Lock()
947 hcomp->State = HAL_COMP_STATE_BUSY_LOCKED; in HAL_COMP_Lock()
952 __HAL_COMP_LOCK(hcomp); in HAL_COMP_Lock()
977 uint32_t HAL_COMP_GetOutputLevel(const COMP_HandleTypeDef *hcomp) in HAL_COMP_GetOutputLevel() argument
980 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_GetOutputLevel()
982 return (uint32_t)((READ_BIT(hcomp->Instance->CSR, COMP_CSR_VALUE)) >> COMP_CSR_VALUE_Pos); in HAL_COMP_GetOutputLevel()
991 __weak void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp) in HAL_COMP_TriggerCallback() argument
994 UNUSED(hcomp); in HAL_COMP_TriggerCallback()
1025 HAL_COMP_StateTypeDef HAL_COMP_GetState(const COMP_HandleTypeDef *hcomp) in HAL_COMP_GetState() argument
1028 if (hcomp == NULL) in HAL_COMP_GetState()
1034 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_GetState()
1037 return hcomp->State; in HAL_COMP_GetState()
1045 uint32_t HAL_COMP_GetError(const COMP_HandleTypeDef *hcomp) in HAL_COMP_GetError() argument
1048 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_GetError()
1050 return hcomp->ErrorCode; in HAL_COMP_GetError()