STM32L4xx_HAL_Driver  1.14.0
stm32l4xx_hal_comp.c
Go to the documentation of this file.
1 
194 /* Includes ------------------------------------------------------------------*/
195 #include "stm32l4xx_hal.h"
196 
201 #ifdef HAL_COMP_MODULE_ENABLED
202 
203 #if defined (COMP1) || defined (COMP2)
204 
210 /* Private typedef -----------------------------------------------------------*/
211 /* Private define ------------------------------------------------------------*/
216 /* Delay for COMP startup time. */
217 /* Note: Delay required to reach propagation delay specification. */
218 /* Literal set to maximum value (refer to device datasheet, */
219 /* parameter "tSTART"). */
220 /* Unit: us */
221 #define COMP_DELAY_STARTUP_US (80UL)
223 /* Delay for COMP voltage scaler stabilization time. */
224 /* Literal set to maximum value (refer to device datasheet, */
225 /* parameter "tSTART_SCALER"). */
226 /* Unit: us */
227 #define COMP_DELAY_VOLTAGE_SCALER_STAB_US (200UL)
229 #define COMP_OUTPUT_LEVEL_BITOFFSET_POS (30UL)
230 
235 /* Private macro -------------------------------------------------------------*/
236 /* Private variables ---------------------------------------------------------*/
237 /* Private function prototypes -----------------------------------------------*/
238 /* Exported functions --------------------------------------------------------*/
239 
265 HAL_StatusTypeDef HAL_COMP_Init(COMP_HandleTypeDef *hcomp)
266 {
267  uint32_t tmp_csr;
268  uint32_t exti_line;
269  uint32_t comp_voltage_scaler_initialized; /* Value "0" if comparator voltage scaler is not initialized */
270  __IO uint32_t wait_loop_index = 0UL;
271  HAL_StatusTypeDef status = HAL_OK;
272 
273  /* Check the COMP handle allocation and lock status */
274  if(hcomp == NULL)
275  {
276  status = HAL_ERROR;
277  }
278  else if(__HAL_COMP_IS_LOCKED(hcomp))
279  {
280  status = HAL_ERROR;
281  }
282  else
283  {
284  /* Check the parameters */
285  assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance));
286  assert_param(IS_COMP_INPUT_PLUS(hcomp->Instance, hcomp->Init.NonInvertingInput));
287  assert_param(IS_COMP_INPUT_MINUS(hcomp->Instance, hcomp->Init.InvertingInput));
288  assert_param(IS_COMP_OUTPUTPOL(hcomp->Init.OutputPol));
289  assert_param(IS_COMP_POWERMODE(hcomp->Init.Mode));
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));
293 #if defined(COMP2)
294  assert_param(IS_COMP_WINDOWMODE(hcomp->Init.WindowMode));
295 #endif
296 
297  if(hcomp->State == HAL_COMP_STATE_RESET)
298  {
299  /* Allocate lock resource and initialize it */
300  hcomp->Lock = HAL_UNLOCKED;
301 
302  /* Set COMP error code to none */
303  COMP_CLEAR_ERRORCODE(hcomp);
304 
305  /* Init SYSCFG and the low level hardware to access comparators */
306  /* Note: HAL_COMP_Init() calls __HAL_RCC_SYSCFG_CLK_ENABLE() */
307  /* to enable internal control clock of the comparators. */
308  /* However, this is a legacy strategy. In future STM32 families, */
309  /* COMP clock enable must be implemented by user */
310  /* in "HAL_COMP_MspInit()". */
311  /* Therefore, for compatibility anticipation, it is recommended */
312  /* to implement __HAL_RCC_SYSCFG_CLK_ENABLE() */
313  /* in "HAL_COMP_MspInit()". */
314  __HAL_RCC_SYSCFG_CLK_ENABLE();
315 
316 #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
317  /* Init the COMP Callback settings */
318  hcomp->TriggerCallback = HAL_COMP_TriggerCallback; /* Legacy weak callback */
319 
320  if (hcomp->MspInitCallback == NULL)
321  {
322  hcomp->MspInitCallback = HAL_COMP_MspInit; /* Legacy weak MspInit */
323  }
324 
325  /* Init the low level hardware */
326  hcomp->MspInitCallback(hcomp);
327 #else
328  /* Init the low level hardware */
329  HAL_COMP_MspInit(hcomp);
330 #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */
331  }
332 
333  /* Memorize voltage scaler state before initialization */
334  comp_voltage_scaler_initialized = READ_BIT(hcomp->Instance->CSR, COMP_CSR_SCALEN);
335 
336  /* Set COMP parameters */
337  tmp_csr = ( hcomp->Init.NonInvertingInput
338  | hcomp->Init.InvertingInput
339  | hcomp->Init.BlankingSrce
340  | hcomp->Init.Hysteresis
341  | hcomp->Init.OutputPol
342  | hcomp->Init.Mode
343  );
344 
345  /* Set parameters in COMP register */
346  /* Note: Update all bits except read-only, lock and enable bits */
347 #if defined (COMP_CSR_INMESEL)
348 #if defined (COMP_CSR_WINMODE)
349  MODIFY_REG(hcomp->Instance->CSR,
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,
353  tmp_csr
354  );
355 #else
356  MODIFY_REG(hcomp->Instance->CSR,
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,
360  tmp_csr
361  );
362 #endif
363 #else
364  MODIFY_REG(hcomp->Instance->CSR,
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,
368  tmp_csr
369  );
370 #endif
371 
372 #if defined(COMP2)
373  /* Set window mode */
374  /* Note: Window mode bit is located into 1 out of the 2 pairs of COMP */
375  /* instances. Therefore, this function can update another COMP */
376  /* instance that the one currently selected. */
377  if(hcomp->Init.WindowMode == COMP_WINDOWMODE_COMP1_INPUT_PLUS_COMMON)
378  {
379  SET_BIT(COMP12_COMMON->CSR, COMP_CSR_WINMODE);
380  }
381  else
382  {
383  CLEAR_BIT(COMP12_COMMON->CSR, COMP_CSR_WINMODE);
384  }
385 #endif /* COMP2 */
386 
387  /* Delay for COMP scaler bridge voltage stabilization */
388  /* Apply the delay if voltage scaler bridge is required and not already enabled */
389  if ((READ_BIT(hcomp->Instance->CSR, COMP_CSR_SCALEN) != 0UL) &&
390  (comp_voltage_scaler_initialized == 0UL) )
391  {
392  /* Wait loop initialization and execution */
393  /* Note: Variable divided by 2 to compensate partially */
394  /* CPU processing cycles, scaling in us split to not */
395  /* exceed 32 bits register capacity and handle low frequency. */
396  wait_loop_index = ((COMP_DELAY_VOLTAGE_SCALER_STAB_US / 10UL) * (SystemCoreClock / (100000UL * 2UL)));
397  while(wait_loop_index != 0UL)
398  {
399  wait_loop_index--;
400  }
401  }
402 
403  /* Get the EXTI line corresponding to the selected COMP instance */
404  exti_line = COMP_GET_EXTI_LINE(hcomp->Instance);
405 
406  /* Manage EXTI settings */
407  if((hcomp->Init.TriggerMode & (COMP_EXTI_IT | COMP_EXTI_EVENT)) != 0UL)
408  {
409  /* Configure EXTI rising edge */
410  if((hcomp->Init.TriggerMode & COMP_EXTI_RISING) != 0UL)
411  {
413  }
414  else
415  {
417  }
418 
419  /* Configure EXTI falling edge */
420  if((hcomp->Init.TriggerMode & COMP_EXTI_FALLING) != 0UL)
421  {
423  }
424  else
425  {
427  }
428 
429  /* Clear COMP EXTI pending bit (if any) */
430  LL_EXTI_ClearFlag_0_31(exti_line);
431 
432  /* Configure EXTI event mode */
433  if((hcomp->Init.TriggerMode & COMP_EXTI_EVENT) != 0UL)
434  {
435  LL_EXTI_EnableEvent_0_31(exti_line);
436  }
437  else
438  {
439  LL_EXTI_DisableEvent_0_31(exti_line);
440  }
441 
442  /* Configure EXTI interrupt mode */
443  if((hcomp->Init.TriggerMode & COMP_EXTI_IT) != 0UL)
444  {
445  LL_EXTI_EnableIT_0_31(exti_line);
446  }
447  else
448  {
449  LL_EXTI_DisableIT_0_31(exti_line);
450  }
451  }
452  else
453  {
454  /* Disable EXTI event mode */
455  LL_EXTI_DisableEvent_0_31(exti_line);
456 
457  /* Disable EXTI interrupt mode */
458  LL_EXTI_DisableIT_0_31(exti_line);
459  }
460 
461  /* Set HAL COMP handle state */
462  /* Note: Transition from state reset to state ready, */
463  /* otherwise (coming from state ready or busy) no state update. */
464  if (hcomp->State == HAL_COMP_STATE_RESET)
465  {
466  hcomp->State = HAL_COMP_STATE_READY;
467  }
468  }
469 
470  return status;
471 }
472 
480 HAL_StatusTypeDef HAL_COMP_DeInit(COMP_HandleTypeDef *hcomp)
481 {
482  HAL_StatusTypeDef status = HAL_OK;
483 
484  /* Check the COMP handle allocation and lock status */
485  if(hcomp == NULL)
486  {
487  status = HAL_ERROR;
488  }
489  else if(__HAL_COMP_IS_LOCKED(hcomp))
490  {
491  status = HAL_ERROR;
492  }
493  else
494  {
495  /* Check the parameter */
496  assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance));
497 
498  /* Set COMP_CSR register to reset value */
499  WRITE_REG(hcomp->Instance->CSR, 0x00000000UL);
500 
501 #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
502  if (hcomp->MspDeInitCallback == NULL)
503  {
504  hcomp->MspDeInitCallback = HAL_COMP_MspDeInit; /* Legacy weak MspDeInit */
505  }
506 
507  /* DeInit the low level hardware: GPIO, RCC clock, NVIC */
508  hcomp->MspDeInitCallback(hcomp);
509 #else
510  /* DeInit the low level hardware: GPIO, RCC clock, NVIC */
511  HAL_COMP_MspDeInit(hcomp);
512 #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */
513 
514  /* Set HAL COMP handle state */
515  hcomp->State = HAL_COMP_STATE_RESET;
516 
517  /* Release Lock */
518  __HAL_UNLOCK(hcomp);
519  }
520 
521  return status;
522 }
523 
530 {
531  /* Prevent unused argument(s) compilation warning */
532  UNUSED(hcomp);
533 
534  /* NOTE : This function should not be modified, when the callback is needed,
535  the HAL_COMP_MspInit could be implemented in the user file
536  */
537 }
538 
545 {
546  /* Prevent unused argument(s) compilation warning */
547  UNUSED(hcomp);
548 
549  /* NOTE : This function should not be modified, when the callback is needed,
550  the HAL_COMP_MspDeInit could be implemented in the user file
551  */
552 }
553 
554 #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
555 
569 {
570  HAL_StatusTypeDef status = HAL_OK;
571 
572  if (pCallback == NULL)
573  {
574  /* Update the error code */
575  hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK;
576 
577  return HAL_ERROR;
578  }
579 
580  if (HAL_COMP_STATE_READY == hcomp->State)
581  {
582  switch (CallbackID)
583  {
585  hcomp->TriggerCallback = pCallback;
586  break;
587 
589  hcomp->MspInitCallback = pCallback;
590  break;
591 
593  hcomp->MspDeInitCallback = pCallback;
594  break;
595 
596  default :
597  /* Update the error code */
598  hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK;
599 
600  /* Return error status */
601  status = HAL_ERROR;
602  break;
603  }
604  }
605  else if (HAL_COMP_STATE_RESET == hcomp->State)
606  {
607  switch (CallbackID)
608  {
610  hcomp->MspInitCallback = pCallback;
611  break;
612 
614  hcomp->MspDeInitCallback = pCallback;
615  break;
616 
617  default :
618  /* Update the error code */
619  hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK;
620 
621  /* Return error status */
622  status = HAL_ERROR;
623  break;
624  }
625  }
626  else
627  {
628  /* Update the error code */
629  hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK;
630 
631  /* Return error status */
632  status = HAL_ERROR;
633  }
634 
635  return status;
636 }
637 
651 {
652  HAL_StatusTypeDef status = HAL_OK;
653 
654  if (HAL_COMP_STATE_READY == hcomp->State)
655  {
656  switch (CallbackID)
657  {
659  hcomp->TriggerCallback = HAL_COMP_TriggerCallback; /* Legacy weak callback */
660  break;
661 
663  hcomp->MspInitCallback = HAL_COMP_MspInit; /* Legacy weak MspInit */
664  break;
665 
667  hcomp->MspDeInitCallback = HAL_COMP_MspDeInit; /* Legacy weak MspDeInit */
668  break;
669 
670  default :
671  /* Update the error code */
672  hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK;
673 
674  /* Return error status */
675  status = HAL_ERROR;
676  break;
677  }
678  }
679  else if (HAL_COMP_STATE_RESET == hcomp->State)
680  {
681  switch (CallbackID)
682  {
684  hcomp->MspInitCallback = HAL_COMP_MspInit; /* Legacy weak MspInit */
685  break;
686 
688  hcomp->MspDeInitCallback = HAL_COMP_MspDeInit; /* Legacy weak MspDeInit */
689  break;
690 
691  default :
692  /* Update the error code */
693  hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK;
694 
695  /* Return error status */
696  status = HAL_ERROR;
697  break;
698  }
699  }
700  else
701  {
702  /* Update the error code */
703  hcomp->ErrorCode |= HAL_COMP_ERROR_INVALID_CALLBACK;
704 
705  /* Return error status */
706  status = HAL_ERROR;
707  }
708 
709  return status;
710 }
711 
712 #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */
713 
738 HAL_StatusTypeDef HAL_COMP_Start(COMP_HandleTypeDef *hcomp)
739 {
740  __IO uint32_t wait_loop_index = 0UL;
741  HAL_StatusTypeDef status = HAL_OK;
742 
743  /* Check the COMP handle allocation and lock status */
744  if(hcomp == NULL)
745  {
746  status = HAL_ERROR;
747  }
748  else if(__HAL_COMP_IS_LOCKED(hcomp))
749  {
750  status = HAL_ERROR;
751  }
752  else
753  {
754  /* Check the parameter */
755  assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance));
756 
757  if(hcomp->State == HAL_COMP_STATE_READY)
758  {
759  /* Enable the selected comparator */
760  SET_BIT(hcomp->Instance->CSR, COMP_CSR_EN);
761 
762  /* Set HAL COMP handle state */
763  hcomp->State = HAL_COMP_STATE_BUSY;
764 
765  /* Delay for COMP startup time */
766  /* Wait loop initialization and execution */
767  /* Note: Variable divided by 2 to compensate partially */
768  /* CPU processing cycles, scaling in us split to not */
769  /* exceed 32 bits register capacity and handle low frequency. */
770  wait_loop_index = ((COMP_DELAY_STARTUP_US / 10UL) * (SystemCoreClock / (100000UL * 2UL)));
771  while(wait_loop_index != 0UL)
772  {
773  wait_loop_index--;
774  }
775  }
776  else
777  {
778  status = HAL_ERROR;
779  }
780  }
781 
782  return status;
783 }
784 
790 HAL_StatusTypeDef HAL_COMP_Stop(COMP_HandleTypeDef *hcomp)
791 {
792  HAL_StatusTypeDef status = HAL_OK;
793 
794  /* Check the COMP handle allocation and lock status */
795  if(hcomp == NULL)
796  {
797  status = HAL_ERROR;
798  }
799  else if(__HAL_COMP_IS_LOCKED(hcomp))
800  {
801  status = HAL_ERROR;
802  }
803  else
804  {
805  /* Check the parameter */
806  assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance));
807 
808  /* Check compliant states: HAL_COMP_STATE_READY or HAL_COMP_STATE_BUSY */
809  /* (all states except HAL_COMP_STATE_RESET and except locked status. */
810  if(hcomp->State != HAL_COMP_STATE_RESET)
811  {
812  /* Disable the selected comparator */
813  CLEAR_BIT(hcomp->Instance->CSR, COMP_CSR_EN);
814 
815  /* Set HAL COMP handle state */
816  hcomp->State = HAL_COMP_STATE_READY;
817  }
818  else
819  {
820  status = HAL_ERROR;
821  }
822  }
823 
824  return status;
825 }
826 
833 {
834  /* Get the EXTI line corresponding to the selected COMP instance */
835  uint32_t exti_line = COMP_GET_EXTI_LINE(hcomp->Instance);
836 
837  /* Check COMP EXTI flag */
838  if(LL_EXTI_IsActiveFlag_0_31(exti_line) != 0UL)
839  {
840 #if defined(COMP2)
841  /* Check whether comparator is in independent or window mode */
842  if(READ_BIT(COMP12_COMMON->CSR, COMP_CSR_WINMODE) != RESET)
843  {
844  /* Clear COMP EXTI line pending bit of the pair of comparators */
845  /* in window mode. */
846  /* Note: Pair of comparators in window mode can both trig IRQ when */
847  /* input voltage is changing from "out of window" area */
848  /* (low or high ) to the other "out of window" area (high or low).*/
849  /* Both flags must be cleared to call comparator trigger */
850  /* callback is called once. */
851  LL_EXTI_ClearFlag_0_31((COMP_EXTI_LINE_COMP1 | COMP_EXTI_LINE_COMP2));
852  }
853  else
854 #endif /* COMP2 */
855  {
856  /* Clear COMP EXTI line pending bit */
857  LL_EXTI_ClearFlag_0_31(exti_line);
858  }
859 
860  /* COMP trigger user callback */
861 #if (USE_HAL_COMP_REGISTER_CALLBACKS == 1)
862  hcomp->TriggerCallback(hcomp);
863 #else
865 #endif /* USE_HAL_COMP_REGISTER_CALLBACKS */
866  }
867 }
868 
895 HAL_StatusTypeDef HAL_COMP_Lock(COMP_HandleTypeDef *hcomp)
896 {
897  HAL_StatusTypeDef status = HAL_OK;
898 
899  /* Check the COMP handle allocation and lock status */
900  if(hcomp == NULL)
901  {
902  status = HAL_ERROR;
903  }
904  else if(__HAL_COMP_IS_LOCKED(hcomp))
905  {
906  status = HAL_ERROR;
907  }
908  else
909  {
910  /* Check the parameter */
911  assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance));
912 
913  /* Set HAL COMP handle state */
914  switch(hcomp->State)
915  {
917  hcomp->State = HAL_COMP_STATE_RESET_LOCKED;
918  break;
920  hcomp->State = HAL_COMP_STATE_READY_LOCKED;
921  break;
922  default: /* HAL_COMP_STATE_BUSY */
923  hcomp->State = HAL_COMP_STATE_BUSY_LOCKED;
924  break;
925  }
926  }
927 
928  if(status == HAL_OK)
929  {
930  /* Set the lock bit corresponding to selected comparator */
931  __HAL_COMP_LOCK(hcomp);
932  }
933 
934  return status;
935 }
936 
957 {
958  /* Check the parameter */
959  assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance));
960 
961  return (uint32_t)(READ_BIT(hcomp->Instance->CSR, COMP_CSR_VALUE)
962  >> COMP_OUTPUT_LEVEL_BITOFFSET_POS);
963 }
964 
971 {
972  /* Prevent unused argument(s) compilation warning */
973  UNUSED(hcomp);
974 
975  /* NOTE : This function should not be modified, when the callback is needed,
976  the HAL_COMP_TriggerCallback should be implemented in the user file
977  */
978 }
979 
980 
1005 {
1006  /* Check the COMP handle allocation */
1007  if(hcomp == NULL)
1008  {
1009  return HAL_COMP_STATE_RESET;
1010  }
1011 
1012  /* Check the parameter */
1013  assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance));
1014 
1015  /* Return HAL COMP handle state */
1016  return hcomp->State;
1017 }
1018 
1025 {
1026  /* Check the parameters */
1027  assert_param(IS_COMP_ALL_INSTANCE(hcomp->Instance));
1028 
1029  return hcomp->ErrorCode;
1030 }
1031 
1044 #endif /* COMP1 || COMP2 */
1045 
1046 #endif /* HAL_COMP_MODULE_ENABLED */
1047 
1052 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
HAL_StatusTypeDef HAL_COMP_Init(COMP_HandleTypeDef *hcomp)
Initialize the COMP according to the specified parameters in the COMP_InitTypeDef and initialize the ...
HAL_StatusTypeDef HAL_COMP_DeInit(COMP_HandleTypeDef *hcomp)
DeInitialize the COMP peripheral.
__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.
HAL_StatusTypeDef HAL_COMP_RegisterCallback(COMP_HandleTypeDef *hcomp, HAL_COMP_CallbackIDTypeDef CallbackID, pCOMP_CallbackTypeDef pCallback)
Register a User COMP Callback To be used instead of the weak predefined callback. ...
__STATIC_INLINE void LL_EXTI_EnableRisingTrig_0_31(uint32_t ExtiLine)
Enable ExtiLine Rising Edge Trigger for Lines in range 0 to 31.
HAL_COMP_StateTypeDef HAL_COMP_GetState(COMP_HandleTypeDef *hcomp)
Return the COMP handle state.
HAL_StatusTypeDef HAL_COMP_Start(COMP_HandleTypeDef *hcomp)
Start the comparator.
This file contains all the functions prototypes for the HAL module driver.
__STATIC_INLINE void LL_EXTI_ClearFlag_0_31(uint32_t ExtiLine)
Clear ExtLine Flags for Lines in range 0 to 31.
void HAL_COMP_MspDeInit(COMP_HandleTypeDef *hcomp)
DeInitialize the COMP MSP.
__HAL_UNLOCK(hrtc)
__STATIC_INLINE uint32_t LL_EXTI_IsActiveFlag_0_31(uint32_t ExtiLine)
Check if the ExtLine Flag is set or not for Lines in range 0 to 31.
HAL_StatusTypeDef HAL_COMP_UnRegisterCallback(COMP_HandleTypeDef *hcomp, HAL_COMP_CallbackIDTypeDef CallbackID)
Unregister a COMP Callback COMP callback is redirected to the weak predefined callback.
CLEAR_BIT(hrtc->Instance->CR, RTC_CR_WUTE)
void(* pCOMP_CallbackTypeDef)(COMP_HandleTypeDef *hcomp)
HAL COMP Callback pointer definition.
HAL_COMP_StateTypeDef
__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.
return HAL_OK
__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.
struct __COMP_HandleTypeDef else typedef struct endif COMP_HandleTypeDef
COMP Handle Structure definition.
void HAL_COMP_MspInit(COMP_HandleTypeDef *hcomp)
Initialize the COMP MSP.
uint32_t HAL_COMP_GetError(COMP_HandleTypeDef *hcomp)
Return the COMP error code.
__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.
HAL_StatusTypeDef HAL_COMP_Lock(COMP_HandleTypeDef *hcomp)
Lock the selected comparator configuration.
HAL_StatusTypeDef HAL_COMP_Stop(COMP_HandleTypeDef *hcomp)
Stop the comparator.
MODIFY_REG(hrtc->Instance->CR, RTC_CR_WUCKSEL,(uint32_t) WakeUpClock)
HAL_COMP_CallbackIDTypeDef
HAL COMP Callback ID enumeration definition.
void HAL_COMP_IRQHandler(COMP_HandleTypeDef *hcomp)
Comparator IRQ handler.
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
uint32_t HAL_COMP_GetOutputLevel(COMP_HandleTypeDef *hcomp)
Return the output level (high or low) of the selected comparator. The output level depends on the sel...