STM32L4xx_HAL_Driver  1.14.0
stm32l4xx_hal_tsc.c
Go to the documentation of this file.
1 
198 /* Includes ------------------------------------------------------------------*/
199 #include "stm32l4xx_hal.h"
200 
210 #ifdef HAL_TSC_MODULE_ENABLED
211 
212 /* Private typedef -----------------------------------------------------------*/
213 /* Private define ------------------------------------------------------------*/
214 /* Private macro -------------------------------------------------------------*/
215 /* Private variables ---------------------------------------------------------*/
216 /* Private function prototypes -----------------------------------------------*/
217 static uint32_t TSC_extract_groups(uint32_t iomask);
218 
219 /* Exported functions --------------------------------------------------------*/
220 
245 HAL_StatusTypeDef HAL_TSC_Init(TSC_HandleTypeDef *htsc)
246 {
247  /* Check TSC handle allocation */
248  if (htsc == NULL)
249  {
250  return HAL_ERROR;
251  }
252 
253  /* Check the parameters */
254  assert_param(IS_TSC_ALL_INSTANCE(htsc->Instance));
255  assert_param(IS_TSC_CTPH(htsc->Init.CTPulseHighLength));
256  assert_param(IS_TSC_CTPL(htsc->Init.CTPulseLowLength));
257  assert_param(IS_TSC_SS(htsc->Init.SpreadSpectrum));
258  assert_param(IS_TSC_SSD(htsc->Init.SpreadSpectrumDeviation));
259  assert_param(IS_TSC_SS_PRESC(htsc->Init.SpreadSpectrumPrescaler));
260  assert_param(IS_TSC_PG_PRESC(htsc->Init.PulseGeneratorPrescaler));
261  assert_param(IS_TSC_MCV(htsc->Init.MaxCountValue));
262  assert_param(IS_TSC_IODEF(htsc->Init.IODefaultMode));
263  assert_param(IS_TSC_SYNC_POL(htsc->Init.SynchroPinPolarity));
264  assert_param(IS_TSC_ACQ_MODE(htsc->Init.AcquisitionMode));
265  assert_param(IS_TSC_MCE_IT(htsc->Init.MaxCountInterrupt));
266  assert_param(IS_TSC_GROUP(htsc->Init.ChannelIOs));
267  assert_param(IS_TSC_GROUP(htsc->Init.ShieldIOs));
268  assert_param(IS_TSC_GROUP(htsc->Init.SamplingIOs));
269 
270  if (htsc->State == HAL_TSC_STATE_RESET)
271  {
272  /* Allocate lock resource and initialize it */
273  htsc->Lock = HAL_UNLOCKED;
274 
275 #if (USE_HAL_TSC_REGISTER_CALLBACKS == 1)
276  /* Init the TSC Callback settings */
277  htsc->ConvCpltCallback = HAL_TSC_ConvCpltCallback; /* Legacy weak ConvCpltCallback */
278  htsc->ErrorCallback = HAL_TSC_ErrorCallback; /* Legacy weak ErrorCallback */
279 
280  if (htsc->MspInitCallback == NULL)
281  {
282  htsc->MspInitCallback = HAL_TSC_MspInit; /* Legacy weak MspInit */
283  }
284 
285  /* Init the low level hardware : GPIO, CLOCK, CORTEX...etc */
286  htsc->MspInitCallback(htsc);
287 #else
288  /* Init the low level hardware : GPIO, CLOCK, CORTEX */
289  HAL_TSC_MspInit(htsc);
290 #endif /* USE_HAL_TSC_REGISTER_CALLBACKS */
291  }
292 
293  /* Initialize the TSC state */
294  htsc->State = HAL_TSC_STATE_BUSY;
295 
296  /*--------------------------------------------------------------------------*/
297  /* Set TSC parameters */
298 
299  /* Enable TSC */
300  htsc->Instance->CR = TSC_CR_TSCE;
301 
302  /* Set all functions */
303  htsc->Instance->CR |= (htsc->Init.CTPulseHighLength |
304  htsc->Init.CTPulseLowLength |
305  (htsc->Init.SpreadSpectrumDeviation << TSC_CR_SSD_Pos) |
308  htsc->Init.MaxCountValue |
309  htsc->Init.SynchroPinPolarity |
310  htsc->Init.AcquisitionMode);
311 
312  /* Spread spectrum */
313  if (htsc->Init.SpreadSpectrum == ENABLE)
314  {
315  htsc->Instance->CR |= TSC_CR_SSE;
316  }
317 
318  /* Disable Schmitt trigger hysteresis on all used TSC IOs */
319  htsc->Instance->IOHCR = (~(htsc->Init.ChannelIOs | htsc->Init.ShieldIOs | htsc->Init.SamplingIOs));
320 
321  /* Set channel and shield IOs */
322  htsc->Instance->IOCCR = (htsc->Init.ChannelIOs | htsc->Init.ShieldIOs);
323 
324  /* Set sampling IOs */
325  htsc->Instance->IOSCR = htsc->Init.SamplingIOs;
326 
327  /* Set the groups to be acquired */
328  htsc->Instance->IOGCSR = TSC_extract_groups(htsc->Init.ChannelIOs);
329 
330  /* Disable interrupts */
331  htsc->Instance->IER &= (~(TSC_IT_EOA | TSC_IT_MCE));
332 
333  /* Clear flags */
334  htsc->Instance->ICR = (TSC_FLAG_EOA | TSC_FLAG_MCE);
335 
336  /*--------------------------------------------------------------------------*/
337 
338  /* Initialize the TSC state */
339  htsc->State = HAL_TSC_STATE_READY;
340 
341  /* Return function status */
342  return HAL_OK;
343 }
344 
350 HAL_StatusTypeDef HAL_TSC_DeInit(TSC_HandleTypeDef *htsc)
351 {
352  /* Check TSC handle allocation */
353  if (htsc == NULL)
354  {
355  return HAL_ERROR;
356  }
357 
358  /* Check the parameters */
359  assert_param(IS_TSC_ALL_INSTANCE(htsc->Instance));
360 
361  /* Change TSC state */
362  htsc->State = HAL_TSC_STATE_BUSY;
363 
364 #if (USE_HAL_TSC_REGISTER_CALLBACKS == 1)
365  if (htsc->MspDeInitCallback == NULL)
366  {
367  htsc->MspDeInitCallback = HAL_TSC_MspDeInit; /* Legacy weak MspDeInit */
368  }
369 
370  /* DeInit the low level hardware: GPIO, CLOCK, NVIC */
371  htsc->MspDeInitCallback(htsc);
372 #else
373  /* DeInit the low level hardware */
374  HAL_TSC_MspDeInit(htsc);
375 #endif /* USE_HAL_TSC_REGISTER_CALLBACKS */
376 
377  /* Change TSC state */
378  htsc->State = HAL_TSC_STATE_RESET;
379 
380  /* Process unlocked */
381  __HAL_UNLOCK(htsc);
382 
383  /* Return function status */
384  return HAL_OK;
385 }
386 
394 {
395  /* Prevent unused argument(s) compilation warning */
396  UNUSED(htsc);
397 
398  /* NOTE : This function should not be modified, when the callback is needed,
399  the HAL_TSC_MspInit could be implemented in the user file.
400  */
401 }
402 
410 {
411  /* Prevent unused argument(s) compilation warning */
412  UNUSED(htsc);
413 
414  /* NOTE : This function should not be modified, when the callback is needed,
415  the HAL_TSC_MspDeInit could be implemented in the user file.
416  */
417 }
418 
419 #if (USE_HAL_TSC_REGISTER_CALLBACKS == 1)
420 
435 {
436  HAL_StatusTypeDef status = HAL_OK;
437 
438  if (pCallback == NULL)
439  {
440  /* Update the error code */
441  htsc->ErrorCode |= HAL_TSC_ERROR_INVALID_CALLBACK;
442 
443  return HAL_ERROR;
444  }
445  /* Process locked */
446  __HAL_LOCK(htsc);
447 
448  if (HAL_TSC_STATE_READY == htsc->State)
449  {
450  switch (CallbackID)
451  {
453  htsc->ConvCpltCallback = pCallback;
454  break;
455 
456  case HAL_TSC_ERROR_CB_ID :
457  htsc->ErrorCallback = pCallback;
458  break;
459 
460  case HAL_TSC_MSPINIT_CB_ID :
461  htsc->MspInitCallback = pCallback;
462  break;
463 
465  htsc->MspDeInitCallback = pCallback;
466  break;
467 
468  default :
469  /* Update the error code */
470  htsc->ErrorCode |= HAL_TSC_ERROR_INVALID_CALLBACK;
471 
472  /* Return error status */
473  status = HAL_ERROR;
474  break;
475  }
476  }
477  else if (HAL_TSC_STATE_RESET == htsc->State)
478  {
479  switch (CallbackID)
480  {
481  case HAL_TSC_MSPINIT_CB_ID :
482  htsc->MspInitCallback = pCallback;
483  break;
484 
486  htsc->MspDeInitCallback = pCallback;
487  break;
488 
489  default :
490  /* Update the error code */
491  htsc->ErrorCode |= HAL_TSC_ERROR_INVALID_CALLBACK;
492 
493  /* Return error status */
494  status = HAL_ERROR;
495  break;
496  }
497  }
498  else
499  {
500  /* Update the error code */
501  htsc->ErrorCode |= HAL_TSC_ERROR_INVALID_CALLBACK;
502 
503  /* Return error status */
504  status = HAL_ERROR;
505  }
506 
507  /* Release Lock */
508  __HAL_UNLOCK(htsc);
509  return status;
510 }
511 
527 {
528  HAL_StatusTypeDef status = HAL_OK;
529 
530  /* Process locked */
531  __HAL_LOCK(htsc);
532 
533  if (HAL_TSC_STATE_READY == htsc->State)
534  {
535  switch (CallbackID)
536  {
538  htsc->ConvCpltCallback = HAL_TSC_ConvCpltCallback; /* Legacy weak ConvCpltCallback */
539  break;
540 
541  case HAL_TSC_ERROR_CB_ID :
542  htsc->ErrorCallback = HAL_TSC_ErrorCallback; /* Legacy weak ErrorCallback */
543  break;
544 
545  case HAL_TSC_MSPINIT_CB_ID :
546  htsc->MspInitCallback = HAL_TSC_MspInit; /* Legacy weak MspInit */
547  break;
548 
550  htsc->MspDeInitCallback = HAL_TSC_MspDeInit; /* Legacy weak MspDeInit */
551  break;
552 
553  default :
554  /* Update the error code */
555  htsc->ErrorCode |= HAL_TSC_ERROR_INVALID_CALLBACK;
556 
557  /* Return error status */
558  status = HAL_ERROR;
559  break;
560  }
561  }
562  else if (HAL_TSC_STATE_RESET == htsc->State)
563  {
564  switch (CallbackID)
565  {
566  case HAL_TSC_MSPINIT_CB_ID :
567  htsc->MspInitCallback = HAL_TSC_MspInit; /* Legacy weak MspInit */
568  break;
569 
571  htsc->MspDeInitCallback = HAL_TSC_MspDeInit; /* Legacy weak MspDeInit */
572  break;
573 
574  default :
575  /* Update the error code */
576  htsc->ErrorCode |= HAL_TSC_ERROR_INVALID_CALLBACK;
577 
578  /* Return error status */
579  status = HAL_ERROR;
580  break;
581  }
582  }
583  else
584  {
585  /* Update the error code */
586  htsc->ErrorCode |= HAL_TSC_ERROR_INVALID_CALLBACK;
587 
588  /* Return error status */
589  status = HAL_ERROR;
590  }
591 
592  /* Release Lock */
593  __HAL_UNLOCK(htsc);
594  return status;
595 }
596 
597 #endif /* USE_HAL_TSC_REGISTER_CALLBACKS */
598 
628 HAL_StatusTypeDef HAL_TSC_Start(TSC_HandleTypeDef *htsc)
629 {
630  /* Check the parameters */
631  assert_param(IS_TSC_ALL_INSTANCE(htsc->Instance));
632 
633  /* Process locked */
634  __HAL_LOCK(htsc);
635 
636  /* Change TSC state */
637  htsc->State = HAL_TSC_STATE_BUSY;
638 
639  /* Clear interrupts */
640  __HAL_TSC_DISABLE_IT(htsc, (TSC_IT_EOA | TSC_IT_MCE));
641 
642  /* Clear flags */
643  __HAL_TSC_CLEAR_FLAG(htsc, (TSC_FLAG_EOA | TSC_FLAG_MCE));
644 
645  /* Set touch sensing IOs not acquired to the specified IODefaultMode */
646  if (htsc->Init.IODefaultMode == TSC_IODEF_OUT_PP_LOW)
647  {
648  __HAL_TSC_SET_IODEF_OUTPPLOW(htsc);
649  }
650  else
651  {
652  __HAL_TSC_SET_IODEF_INFLOAT(htsc);
653  }
654 
655  /* Launch the acquisition */
656  __HAL_TSC_START_ACQ(htsc);
657 
658  /* Process unlocked */
659  __HAL_UNLOCK(htsc);
660 
661  /* Return function status */
662  return HAL_OK;
663 }
664 
671 HAL_StatusTypeDef HAL_TSC_Start_IT(TSC_HandleTypeDef *htsc)
672 {
673  /* Check the parameters */
674  assert_param(IS_TSC_ALL_INSTANCE(htsc->Instance));
675  assert_param(IS_TSC_MCE_IT(htsc->Init.MaxCountInterrupt));
676 
677  /* Process locked */
678  __HAL_LOCK(htsc);
679 
680  /* Change TSC state */
681  htsc->State = HAL_TSC_STATE_BUSY;
682 
683  /* Enable end of acquisition interrupt */
684  __HAL_TSC_ENABLE_IT(htsc, TSC_IT_EOA);
685 
686  /* Enable max count error interrupt (optional) */
687  if (htsc->Init.MaxCountInterrupt == ENABLE)
688  {
689  __HAL_TSC_ENABLE_IT(htsc, TSC_IT_MCE);
690  }
691  else
692  {
693  __HAL_TSC_DISABLE_IT(htsc, TSC_IT_MCE);
694  }
695 
696  /* Clear flags */
697  __HAL_TSC_CLEAR_FLAG(htsc, (TSC_FLAG_EOA | TSC_FLAG_MCE));
698 
699  /* Set touch sensing IOs not acquired to the specified IODefaultMode */
700  if (htsc->Init.IODefaultMode == TSC_IODEF_OUT_PP_LOW)
701  {
702  __HAL_TSC_SET_IODEF_OUTPPLOW(htsc);
703  }
704  else
705  {
706  __HAL_TSC_SET_IODEF_INFLOAT(htsc);
707  }
708 
709  /* Launch the acquisition */
710  __HAL_TSC_START_ACQ(htsc);
711 
712  /* Process unlocked */
713  __HAL_UNLOCK(htsc);
714 
715  /* Return function status */
716  return HAL_OK;
717 }
718 
725 HAL_StatusTypeDef HAL_TSC_Stop(TSC_HandleTypeDef *htsc)
726 {
727  /* Check the parameters */
728  assert_param(IS_TSC_ALL_INSTANCE(htsc->Instance));
729 
730  /* Process locked */
731  __HAL_LOCK(htsc);
732 
733  /* Stop the acquisition */
734  __HAL_TSC_STOP_ACQ(htsc);
735 
736  /* Set touch sensing IOs in low power mode (output push-pull) */
737  __HAL_TSC_SET_IODEF_OUTPPLOW(htsc);
738 
739  /* Clear flags */
740  __HAL_TSC_CLEAR_FLAG(htsc, (TSC_FLAG_EOA | TSC_FLAG_MCE));
741 
742  /* Change TSC state */
743  htsc->State = HAL_TSC_STATE_READY;
744 
745  /* Process unlocked */
746  __HAL_UNLOCK(htsc);
747 
748  /* Return function status */
749  return HAL_OK;
750 }
751 
758 HAL_StatusTypeDef HAL_TSC_Stop_IT(TSC_HandleTypeDef *htsc)
759 {
760  /* Check the parameters */
761  assert_param(IS_TSC_ALL_INSTANCE(htsc->Instance));
762 
763  /* Process locked */
764  __HAL_LOCK(htsc);
765 
766  /* Stop the acquisition */
767  __HAL_TSC_STOP_ACQ(htsc);
768 
769  /* Set touch sensing IOs in low power mode (output push-pull) */
770  __HAL_TSC_SET_IODEF_OUTPPLOW(htsc);
771 
772  /* Disable interrupts */
773  __HAL_TSC_DISABLE_IT(htsc, (TSC_IT_EOA | TSC_IT_MCE));
774 
775  /* Clear flags */
776  __HAL_TSC_CLEAR_FLAG(htsc, (TSC_FLAG_EOA | TSC_FLAG_MCE));
777 
778  /* Change TSC state */
779  htsc->State = HAL_TSC_STATE_READY;
780 
781  /* Process unlocked */
782  __HAL_UNLOCK(htsc);
783 
784  /* Return function status */
785  return HAL_OK;
786 }
787 
797 {
798  /* Check the parameters */
799  assert_param(IS_TSC_ALL_INSTANCE(htsc->Instance));
800 
801  /* Process locked */
802  __HAL_LOCK(htsc);
803 
804  /* Check end of acquisition */
805  while (HAL_TSC_GetState(htsc) == HAL_TSC_STATE_BUSY)
806  {
807  /* The timeout (max count error) is managed by the TSC peripheral itself. */
808  }
809 
810  /* Process unlocked */
811  __HAL_UNLOCK(htsc);
812 
813  return HAL_OK;
814 }
815 
824 {
825  /* Check the parameters */
826  assert_param(IS_TSC_ALL_INSTANCE(htsc->Instance));
827  assert_param(IS_TSC_GROUP_INDEX(gx_index));
828 
829  /* Return the group status */
830  return (__HAL_TSC_GET_GROUP_STATUS(htsc, gx_index));
831 }
832 
840 uint32_t HAL_TSC_GroupGetValue(TSC_HandleTypeDef *htsc, uint32_t gx_index)
841 {
842  /* Check the parameters */
843  assert_param(IS_TSC_ALL_INSTANCE(htsc->Instance));
844  assert_param(IS_TSC_GROUP_INDEX(gx_index));
845 
846  /* Return the group acquisition counter */
847  return htsc->Instance->IOGXCR[gx_index];
848 }
849 
875 HAL_StatusTypeDef HAL_TSC_IOConfig(TSC_HandleTypeDef *htsc, TSC_IOConfigTypeDef *config)
876 {
877  /* Check the parameters */
878  assert_param(IS_TSC_ALL_INSTANCE(htsc->Instance));
879  assert_param(IS_TSC_GROUP(config->ChannelIOs));
880  assert_param(IS_TSC_GROUP(config->ShieldIOs));
881  assert_param(IS_TSC_GROUP(config->SamplingIOs));
882 
883  /* Process locked */
884  __HAL_LOCK(htsc);
885 
886  /* Stop acquisition */
887  __HAL_TSC_STOP_ACQ(htsc);
888 
889  /* Disable Schmitt trigger hysteresis on all used TSC IOs */
890  htsc->Instance->IOHCR = (~(config->ChannelIOs | config->ShieldIOs | config->SamplingIOs));
891 
892  /* Set channel and shield IOs */
893  htsc->Instance->IOCCR = (config->ChannelIOs | config->ShieldIOs);
894 
895  /* Set sampling IOs */
896  htsc->Instance->IOSCR = config->SamplingIOs;
897 
898  /* Set groups to be acquired */
899  htsc->Instance->IOGCSR = TSC_extract_groups(config->ChannelIOs);
900 
901  /* Process unlocked */
902  __HAL_UNLOCK(htsc);
903 
904  /* Return function status */
905  return HAL_OK;
906 }
907 
915 HAL_StatusTypeDef HAL_TSC_IODischarge(TSC_HandleTypeDef *htsc, FunctionalState choice)
916 {
917  /* Check the parameters */
918  assert_param(IS_TSC_ALL_INSTANCE(htsc->Instance));
919 
920  /* Process locked */
921  __HAL_LOCK(htsc);
922 
923  if (choice == ENABLE)
924  {
925  __HAL_TSC_SET_IODEF_OUTPPLOW(htsc);
926  }
927  else
928  {
929  __HAL_TSC_SET_IODEF_INFLOAT(htsc);
930  }
931 
932  /* Process unlocked */
933  __HAL_UNLOCK(htsc);
934 
935  /* Return the group acquisition counter */
936  return HAL_OK;
937 }
938 
965 {
966  /* Check the parameters */
967  assert_param(IS_TSC_ALL_INSTANCE(htsc->Instance));
968 
969  if (htsc->State == HAL_TSC_STATE_BUSY)
970  {
971  /* Check end of acquisition flag */
972  if (__HAL_TSC_GET_FLAG(htsc, TSC_FLAG_EOA) != RESET)
973  {
974  /* Check max count error flag */
975  if (__HAL_TSC_GET_FLAG(htsc, TSC_FLAG_MCE) != RESET)
976  {
977  /* Change TSC state */
978  htsc->State = HAL_TSC_STATE_ERROR;
979  }
980  else
981  {
982  /* Change TSC state */
983  htsc->State = HAL_TSC_STATE_READY;
984  }
985  }
986  }
987 
988  /* Return TSC state */
989  return htsc->State;
990 }
991 
1007 {
1008  /* Check the parameters */
1009  assert_param(IS_TSC_ALL_INSTANCE(htsc->Instance));
1010 
1011  /* Check if the end of acquisition occurred */
1012  if (__HAL_TSC_GET_FLAG(htsc, TSC_FLAG_EOA) != RESET)
1013  {
1014  /* Clear EOA flag */
1015  __HAL_TSC_CLEAR_FLAG(htsc, TSC_FLAG_EOA);
1016  }
1017 
1018  /* Check if max count error occurred */
1019  if (__HAL_TSC_GET_FLAG(htsc, TSC_FLAG_MCE) != RESET)
1020  {
1021  /* Clear MCE flag */
1022  __HAL_TSC_CLEAR_FLAG(htsc, TSC_FLAG_MCE);
1023  /* Change TSC state */
1024  htsc->State = HAL_TSC_STATE_ERROR;
1025 #if (USE_HAL_TSC_REGISTER_CALLBACKS == 1)
1026  htsc->ErrorCallback(htsc);
1027 #else
1028  /* Conversion completed callback */
1029  HAL_TSC_ErrorCallback(htsc);
1030 #endif /* USE_HAL_TSC_REGISTER_CALLBACKS */
1031  }
1032  else
1033  {
1034  /* Change TSC state */
1035  htsc->State = HAL_TSC_STATE_READY;
1036 #if (USE_HAL_TSC_REGISTER_CALLBACKS == 1)
1037  htsc->ConvCpltCallback(htsc);
1038 #else
1039  /* Conversion completed callback */
1041 #endif /* USE_HAL_TSC_REGISTER_CALLBACKS */
1042  }
1043 }
1044 
1052 {
1053  /* Prevent unused argument(s) compilation warning */
1054  UNUSED(htsc);
1055 
1056  /* NOTE : This function should not be modified, when the callback is needed,
1057  the HAL_TSC_ConvCpltCallback could be implemented in the user file.
1058  */
1059 }
1060 
1068 {
1069  /* Prevent unused argument(s) compilation warning */
1070  UNUSED(htsc);
1071 
1072  /* NOTE : This function should not be modified, when the callback is needed,
1073  the HAL_TSC_ErrorCallback could be implemented in the user file.
1074  */
1075 }
1076 
1085 /* Private functions ---------------------------------------------------------*/
1095 static uint32_t TSC_extract_groups(uint32_t iomask)
1096 {
1097  uint32_t groups = 0UL;
1098  uint32_t idx;
1099 
1100  for (idx = 0UL; idx < (uint32_t)TSC_NB_OF_GROUPS; idx++)
1101  {
1102  if ((iomask & (0x0FUL << (idx * 4UL))) != 0UL )
1103  {
1104  groups |= (1UL << idx);
1105  }
1106  }
1107 
1108  return groups;
1109 }
1110 
1115 #endif /* HAL_TSC_MODULE_ENABLED */
1116 
1125 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
HAL_StatusTypeDef HAL_TSC_IODischarge(TSC_HandleTypeDef *htsc, FunctionalState choice)
Discharge TSC IOs.
HAL_StatusTypeDef HAL_TSC_DeInit(TSC_HandleTypeDef *htsc)
Deinitialize the TSC peripheral registers to their default reset values.
TSC_InitTypeDef Init
void HAL_TSC_ErrorCallback(TSC_HandleTypeDef *htsc)
Error callback in non-blocking mode.
HAL_StatusTypeDef HAL_TSC_IOConfig(TSC_HandleTypeDef *htsc, TSC_IOConfigTypeDef *config)
Configure TSC IOs.
TSC IOs configuration structure definition.
This file contains all the functions prototypes for the HAL module driver.
HAL_StatusTypeDef HAL_TSC_Stop_IT(TSC_HandleTypeDef *htsc)
Stop the acquisition previously launched in interrupt mode.
__IO HAL_TSC_StateTypeDef State
void HAL_TSC_MspInit(TSC_HandleTypeDef *htsc)
Initialize the TSC MSP.
void HAL_TSC_ConvCpltCallback(TSC_HandleTypeDef *htsc)
Acquisition completed callback in non-blocking mode.
__HAL_UNLOCK(hrtc)
uint32_t SynchroPinPolarity
HAL_StatusTypeDef HAL_TSC_Start(TSC_HandleTypeDef *htsc)
Start the acquisition.
__HAL_LOCK(hrtc)
void(* MspInitCallback)(struct __TSC_HandleTypeDef *htsc)
HAL_TSC_StateTypeDef HAL_TSC_GetState(TSC_HandleTypeDef *htsc)
Return the TSC handle state.
TSC_GroupStatusTypeDef HAL_TSC_GroupGetStatus(TSC_HandleTypeDef *htsc, uint32_t gx_index)
Get the acquisition status for a group.
return HAL_OK
uint32_t SpreadSpectrumDeviation
HAL_TSC_CallbackIDTypeDef
HAL TSC Callback ID enumeration definition.
void HAL_TSC_IRQHandler(TSC_HandleTypeDef *htsc)
Handle TSC interrupt request.
uint32_t HAL_TSC_GroupGetValue(TSC_HandleTypeDef *htsc, uint32_t gx_index)
Get the acquisition measure for a group.
void(* ConvCpltCallback)(struct __TSC_HandleTypeDef *htsc)
FunctionalState MaxCountInterrupt
void HAL_TSC_MspDeInit(TSC_HandleTypeDef *htsc)
DeInitialize the TSC MSP.
TSC handle Structure definition.
void(* pTSC_CallbackTypeDef)(TSC_HandleTypeDef *htsc)
HAL TSC Callback pointer definition.
uint32_t CTPulseLowLength
HAL_StatusTypeDef HAL_TSC_PollForAcquisition(TSC_HandleTypeDef *htsc)
Start acquisition and wait until completion.
static uint32_t TSC_extract_groups(uint32_t iomask)
Utility function used to set the acquired groups mask.
uint32_t CTPulseHighLength
HAL_StatusTypeDef HAL_TSC_Stop(TSC_HandleTypeDef *htsc)
Stop the acquisition previously launched in polling mode.
FunctionalState SpreadSpectrum
HAL_TSC_StateTypeDef
TSC state structure definition.
void(* MspDeInitCallback)(struct __TSC_HandleTypeDef *htsc)
HAL_StatusTypeDef HAL_TSC_RegisterCallback(TSC_HandleTypeDef *htsc, HAL_TSC_CallbackIDTypeDef CallbackID, pTSC_CallbackTypeDef pCallback)
Register a User TSC Callback To be used instead of the weak predefined callback.
HAL_StatusTypeDef HAL_TSC_Init(TSC_HandleTypeDef *htsc)
Initialize the TSC peripheral according to the specified parameters in the TSC_InitTypeDef structure ...
uint32_t AcquisitionMode
uint32_t PulseGeneratorPrescaler
HAL_StatusTypeDef HAL_TSC_UnRegisterCallback(TSC_HandleTypeDef *htsc, HAL_TSC_CallbackIDTypeDef CallbackID)
Unregister an TSC Callback TSC callback is redirected to the weak predefined callback.
TSC_GroupStatusTypeDef
TSC group status structure definition.
HAL_StatusTypeDef HAL_TSC_Start_IT(TSC_HandleTypeDef *htsc)
Start the acquisition in interrupt mode.
void(* ErrorCallback)(struct __TSC_HandleTypeDef *htsc)
uint32_t SpreadSpectrumPrescaler
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))
HAL_LockTypeDef Lock