Lines Matching refs:hcomp

269 HAL_StatusTypeDef HAL_COMP_Init(COMP_HandleTypeDef *hcomp)  in HAL_COMP_Init()  argument
278 if((hcomp == NULL) || (__HAL_COMP_IS_LOCKED(hcomp))) in HAL_COMP_Init()
285 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_Init()
286 assert_param(IS_COMP_INPUT_PLUS(hcomp->Instance, hcomp->Init.NonInvertingInput)); in HAL_COMP_Init()
287 assert_param(IS_COMP_INPUT_MINUS(hcomp->Instance, hcomp->Init.InvertingInput)); in HAL_COMP_Init()
288 assert_param(IS_COMP_OUTPUTPOL(hcomp->Init.OutputPol)); in HAL_COMP_Init()
289 assert_param(IS_COMP_POWERMODE(hcomp->Init.Mode)); in HAL_COMP_Init()
290 assert_param(IS_COMP_TRIGGERMODE(hcomp->Init.TriggerMode)); in HAL_COMP_Init()
291 assert_param(IS_COMP_WINDOWMODE(hcomp->Init.WindowMode)); in HAL_COMP_Init()
293 if(hcomp->State == HAL_COMP_STATE_RESET) in HAL_COMP_Init()
296 hcomp->Lock = HAL_UNLOCKED; in HAL_COMP_Init()
311 hcomp->TriggerCallback = HAL_COMP_TriggerCallback; /* Legacy weak callback */ in HAL_COMP_Init()
313 if (hcomp->MspInitCallback == NULL) in HAL_COMP_Init()
315 hcomp->MspInitCallback = HAL_COMP_MspInit; /* Legacy weak MspInit */ in HAL_COMP_Init()
319 hcomp->MspInitCallback(hcomp); in HAL_COMP_Init()
322 HAL_COMP_MspInit(hcomp); in HAL_COMP_Init()
327 tmp_csr = (hcomp->Init.InvertingInput | in HAL_COMP_Init()
328 hcomp->Init.OutputPol ); in HAL_COMP_Init()
331 if ((hcomp->Instance) == COMP2) in HAL_COMP_Init()
335 tmp_csr |= (hcomp->Init.NonInvertingInput | in HAL_COMP_Init()
336 hcomp->Init.Mode ); in HAL_COMP_Init()
340 if((hcomp->Init.InvertingInput == COMP_INPUT_MINUS_VREFINT) || in HAL_COMP_Init()
341 (hcomp->Init.InvertingInput == COMP_INPUT_MINUS_1_4VREFINT) || in HAL_COMP_Init()
342 (hcomp->Init.InvertingInput == COMP_INPUT_MINUS_1_2VREFINT) || in HAL_COMP_Init()
343 (hcomp->Init.InvertingInput == COMP_INPUT_MINUS_3_4VREFINT) ) in HAL_COMP_Init()
368 if (hcomp->Init.LPTIMConnection != COMP_LPTIMCONNECTION_DISABLED) in HAL_COMP_Init()
371 if ((hcomp->Instance) == COMP1) in HAL_COMP_Init()
374 assert_param(IS_COMP1_LPTIMCONNECTION(hcomp->Init.LPTIMConnection)); in HAL_COMP_Init()
384 assert_param(IS_COMP2_LPTIMCONNECTION(hcomp->Init.LPTIMConnection)); in HAL_COMP_Init()
386 switch (hcomp->Init.LPTIMConnection) in HAL_COMP_Init()
404 assert_param(IS_COMP2_LPTIMCONNECTION_RESTRICTED(hcomp->Init.LPTIMConnection)); in HAL_COMP_Init()
419 if ((hcomp->Instance) == COMP1) in HAL_COMP_Init()
421 MODIFY_REG(hcomp->Instance->CSR, in HAL_COMP_Init()
429 MODIFY_REG(hcomp->Instance->CSR, in HAL_COMP_Init()
441 if(hcomp->Init.WindowMode == COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON) in HAL_COMP_Init()
451 exti_line = COMP_GET_EXTI_LINE(hcomp->Instance); in HAL_COMP_Init()
454 if((hcomp->Init.TriggerMode & (COMP_EXTI_IT | COMP_EXTI_EVENT)) != RESET) in HAL_COMP_Init()
457 if((hcomp->Init.TriggerMode & COMP_EXTI_RISING) != RESET) in HAL_COMP_Init()
467 if((hcomp->Init.TriggerMode & COMP_EXTI_FALLING) != RESET) in HAL_COMP_Init()
480 if((hcomp->Init.TriggerMode & COMP_EXTI_EVENT) != RESET) in HAL_COMP_Init()
490 if((hcomp->Init.TriggerMode & COMP_EXTI_IT) != RESET) in HAL_COMP_Init()
511 if (hcomp->State == HAL_COMP_STATE_RESET) in HAL_COMP_Init()
513 hcomp->State = HAL_COMP_STATE_READY; in HAL_COMP_Init()
527 HAL_StatusTypeDef HAL_COMP_DeInit(COMP_HandleTypeDef *hcomp) in HAL_COMP_DeInit() argument
532 if((hcomp == NULL) || (__HAL_COMP_IS_LOCKED(hcomp))) in HAL_COMP_DeInit()
539 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_DeInit()
542 WRITE_REG(hcomp->Instance->CSR, 0x00000000U); in HAL_COMP_DeInit()
545 if (hcomp->MspDeInitCallback == NULL) in HAL_COMP_DeInit()
547 hcomp->MspDeInitCallback = HAL_COMP_MspDeInit; /* Legacy weak MspDeInit */ in HAL_COMP_DeInit()
551 hcomp->MspDeInitCallback(hcomp); in HAL_COMP_DeInit()
554 HAL_COMP_MspDeInit(hcomp); in HAL_COMP_DeInit()
558 hcomp->State = HAL_COMP_STATE_RESET; in HAL_COMP_DeInit()
561 __HAL_UNLOCK(hcomp); in HAL_COMP_DeInit()
572 __weak void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp) in HAL_COMP_MspInit() argument
575 UNUSED(hcomp); in HAL_COMP_MspInit()
587 __weak void HAL_COMP_MspDeInit(COMP_HandleTypeDef *hcomp) in HAL_COMP_MspDeInit() argument
590 UNUSED(hcomp); in HAL_COMP_MspDeInit()
611 HAL_StatusTypeDef HAL_COMP_RegisterCallback(COMP_HandleTypeDef *hcomp, HAL_COMP_CallbackIDTypeDef C… in HAL_COMP_RegisterCallback() argument
618 hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK; in HAL_COMP_RegisterCallback()
623 if (HAL_COMP_STATE_READY == hcomp->State) in HAL_COMP_RegisterCallback()
628 hcomp->TriggerCallback = pCallback; in HAL_COMP_RegisterCallback()
632 hcomp->MspInitCallback = pCallback; in HAL_COMP_RegisterCallback()
636 hcomp->MspDeInitCallback = pCallback; in HAL_COMP_RegisterCallback()
641 hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK; in HAL_COMP_RegisterCallback()
648 else if (HAL_COMP_STATE_RESET == hcomp->State) in HAL_COMP_RegisterCallback()
653 hcomp->MspInitCallback = pCallback; in HAL_COMP_RegisterCallback()
657 hcomp->MspDeInitCallback = pCallback; in HAL_COMP_RegisterCallback()
662 hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK; in HAL_COMP_RegisterCallback()
672 hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK; in HAL_COMP_RegisterCallback()
693 HAL_StatusTypeDef HAL_COMP_UnRegisterCallback(COMP_HandleTypeDef *hcomp, HAL_COMP_CallbackIDTypeDef… in HAL_COMP_UnRegisterCallback() argument
697 if (HAL_COMP_STATE_READY == hcomp->State) in HAL_COMP_UnRegisterCallback()
702 hcomp->TriggerCallback = HAL_COMP_TriggerCallback; /* Legacy weak callback */ in HAL_COMP_UnRegisterCallback()
706 hcomp->MspInitCallback = HAL_COMP_MspInit; /* Legacy weak MspInit */ in HAL_COMP_UnRegisterCallback()
710 hcomp->MspDeInitCallback = HAL_COMP_MspDeInit; /* Legacy weak MspDeInit */ in HAL_COMP_UnRegisterCallback()
715 hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK; in HAL_COMP_UnRegisterCallback()
722 else if (HAL_COMP_STATE_RESET == hcomp->State) in HAL_COMP_UnRegisterCallback()
727 hcomp->MspInitCallback = HAL_COMP_MspInit; /* Legacy weak MspInit */ in HAL_COMP_UnRegisterCallback()
731 hcomp->MspDeInitCallback = HAL_COMP_MspDeInit; /* Legacy weak MspDeInit */ in HAL_COMP_UnRegisterCallback()
736 hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK; in HAL_COMP_UnRegisterCallback()
746 hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK; in HAL_COMP_UnRegisterCallback()
781 HAL_StatusTypeDef HAL_COMP_Start(COMP_HandleTypeDef *hcomp) in HAL_COMP_Start() argument
787 if((hcomp == NULL) || (__HAL_COMP_IS_LOCKED(hcomp))) in HAL_COMP_Start()
794 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_Start()
796 if(hcomp->State == HAL_COMP_STATE_READY) in HAL_COMP_Start()
799 SET_BIT(hcomp->Instance->CSR, COMP_CSR_COMPxEN); in HAL_COMP_Start()
802 hcomp->State = HAL_COMP_STATE_BUSY; in HAL_COMP_Start()
828 HAL_StatusTypeDef HAL_COMP_Stop(COMP_HandleTypeDef *hcomp) in HAL_COMP_Stop() argument
833 if((hcomp == NULL) || (__HAL_COMP_IS_LOCKED(hcomp))) in HAL_COMP_Stop()
840 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_Stop()
842 if((hcomp->State == HAL_COMP_STATE_BUSY) || in HAL_COMP_Stop()
843 (hcomp->State == HAL_COMP_STATE_READY) ) in HAL_COMP_Stop()
846 CLEAR_BIT(hcomp->Instance->CSR, COMP_CSR_COMPxEN); in HAL_COMP_Stop()
849 hcomp->State = HAL_COMP_STATE_READY; in HAL_COMP_Stop()
865 void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp) in HAL_COMP_IRQHandler() argument
868 uint32_t exti_line = COMP_GET_EXTI_LINE(hcomp->Instance); in HAL_COMP_IRQHandler()
893 hcomp->TriggerCallback(hcomp); in HAL_COMP_IRQHandler()
895 HAL_COMP_TriggerCallback(hcomp); in HAL_COMP_IRQHandler()
926 HAL_StatusTypeDef HAL_COMP_Lock(COMP_HandleTypeDef *hcomp) in HAL_COMP_Lock() argument
931 if((hcomp == NULL) || (__HAL_COMP_IS_LOCKED(hcomp))) in HAL_COMP_Lock()
938 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_Lock()
941 hcomp->State = ((HAL_COMP_StateTypeDef)(hcomp->State | COMP_STATE_BITFIELD_LOCK)); in HAL_COMP_Lock()
947 __HAL_COMP_LOCK(hcomp); in HAL_COMP_Lock()
972 uint32_t HAL_COMP_GetOutputLevel(COMP_HandleTypeDef *hcomp) in HAL_COMP_GetOutputLevel() argument
975 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_GetOutputLevel()
977 return (uint32_t)(READ_BIT(hcomp->Instance->CSR, COMP_CSR_COMPxOUTVALUE) in HAL_COMP_GetOutputLevel()
986 __weak void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp) in HAL_COMP_TriggerCallback() argument
989 UNUSED(hcomp); in HAL_COMP_TriggerCallback()
1020 HAL_COMP_StateTypeDef HAL_COMP_GetState(COMP_HandleTypeDef *hcomp) in HAL_COMP_GetState() argument
1023 if(hcomp == NULL) in HAL_COMP_GetState()
1029 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_GetState()
1032 return hcomp->State; in HAL_COMP_GetState()
1040 uint32_t HAL_COMP_GetError(COMP_HandleTypeDef *hcomp) in HAL_COMP_GetError() argument
1043 assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance)); in HAL_COMP_GetError()
1045 return hcomp->ErrorCode; in HAL_COMP_GetError()