STM32L4xx_HAL_Driver  1.14.0
Input and Output operation functions

Input and Output operation functions. More...

Functions

HAL_StatusTypeDef HAL_TSC_Start (TSC_HandleTypeDef *htsc)
 Start the acquisition. More...
 
HAL_StatusTypeDef HAL_TSC_Start_IT (TSC_HandleTypeDef *htsc)
 Start the acquisition in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TSC_Stop (TSC_HandleTypeDef *htsc)
 Stop the acquisition previously launched in polling mode. More...
 
HAL_StatusTypeDef HAL_TSC_Stop_IT (TSC_HandleTypeDef *htsc)
 Stop the acquisition previously launched in interrupt mode. More...
 
HAL_StatusTypeDef HAL_TSC_PollForAcquisition (TSC_HandleTypeDef *htsc)
 Start acquisition and wait until completion. More...
 
TSC_GroupStatusTypeDef HAL_TSC_GroupGetStatus (TSC_HandleTypeDef *htsc, uint32_t gx_index)
 Get the acquisition status for a group. More...
 
uint32_t HAL_TSC_GroupGetValue (TSC_HandleTypeDef *htsc, uint32_t gx_index)
 Get the acquisition measure for a group. More...
 

Detailed Description

Input and Output operation functions.

 ===============================================================================
             ##### IO Operation functions #####
 ===============================================================================
    [..]  This section provides functions allowing to:
      (+) Start acquisition in polling mode.
      (+) Start acquisition in interrupt mode.
      (+) Stop conversion in polling mode.
      (+) Stop conversion in interrupt mode.
      (+) Poll for acquisition completed.
      (+) Get group acquisition status.
      (+) Get group acquisition value.

Function Documentation

◆ HAL_TSC_GroupGetStatus()

TSC_GroupStatusTypeDef HAL_TSC_GroupGetStatus ( TSC_HandleTypeDef htsc,
uint32_t  gx_index 
)

Get the acquisition status for a group.

Parameters
htscPointer to a TSC_HandleTypeDef structure that contains the configuration information for the specified TSC.
gx_indexIndex of the group
Return values
Groupstatus

Definition at line 823 of file stm32l4xx_hal_tsc.c.

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 }
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_TSC_GroupGetValue()

uint32_t HAL_TSC_GroupGetValue ( TSC_HandleTypeDef htsc,
uint32_t  gx_index 
)

Get the acquisition measure for a group.

Parameters
htscPointer to a TSC_HandleTypeDef structure that contains the configuration information for the specified TSC.
gx_indexIndex of the group
Return values
Acquisitionmeasure

Definition at line 840 of file stm32l4xx_hal_tsc.c.

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 }
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_TSC_PollForAcquisition()

HAL_StatusTypeDef HAL_TSC_PollForAcquisition ( TSC_HandleTypeDef htsc)

Start acquisition and wait until completion.

Note
There is no need of a timeout parameter as the max count error is already managed by the TSC peripheral.
Parameters
htscPointer to a TSC_HandleTypeDef structure that contains the configuration information for the specified TSC.
Return values
HALstate

Definition at line 796 of file stm32l4xx_hal_tsc.c.

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 }
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
HAL_TSC_StateTypeDef HAL_TSC_GetState(TSC_HandleTypeDef *htsc)
Return the TSC handle state.
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_TSC_Start()

HAL_StatusTypeDef HAL_TSC_Start ( TSC_HandleTypeDef htsc)

Start the acquisition.

Parameters
htscPointer to a TSC_HandleTypeDef structure that contains the configuration information for the specified TSC.
Return values
HALstatus

Definition at line 628 of file stm32l4xx_hal_tsc.c.

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 }
TSC_InitTypeDef Init
__IO HAL_TSC_StateTypeDef State
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_TSC_Start_IT()

HAL_StatusTypeDef HAL_TSC_Start_IT ( TSC_HandleTypeDef htsc)

Start the acquisition in interrupt mode.

Parameters
htscPointer to a TSC_HandleTypeDef structure that contains the configuration information for the specified TSC.
Return values
HALstatus.

Definition at line 671 of file stm32l4xx_hal_tsc.c.

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 }
TSC_InitTypeDef Init
__IO HAL_TSC_StateTypeDef State
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
FunctionalState MaxCountInterrupt
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_TSC_Stop()

HAL_StatusTypeDef HAL_TSC_Stop ( TSC_HandleTypeDef htsc)

Stop the acquisition previously launched in polling mode.

Parameters
htscPointer to a TSC_HandleTypeDef structure that contains the configuration information for the specified TSC.
Return values
HALstatus

Definition at line 725 of file stm32l4xx_hal_tsc.c.

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 }
__IO HAL_TSC_StateTypeDef State
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))

◆ HAL_TSC_Stop_IT()

HAL_StatusTypeDef HAL_TSC_Stop_IT ( TSC_HandleTypeDef htsc)

Stop the acquisition previously launched in interrupt mode.

Parameters
htscPointer to a TSC_HandleTypeDef structure that contains the configuration information for the specified TSC.
Return values
HALstatus

Definition at line 758 of file stm32l4xx_hal_tsc.c.

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 }
__IO HAL_TSC_StateTypeDef State
__HAL_UNLOCK(hrtc)
__HAL_LOCK(hrtc)
return HAL_OK
assert_param(IS_RTC_WAKEUP_CLOCK(WakeUpClock))