Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
107:4f6c30876dfa
.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 107:4f6c30876dfa 1 /**
Kojto 107:4f6c30876dfa 2 ******************************************************************************
Kojto 107:4f6c30876dfa 3 * @file stm32l4xx_hal_tsc.h
Kojto 107:4f6c30876dfa 4 * @author MCD Application Team
Kojto 107:4f6c30876dfa 5 * @version V1.0.0
Kojto 107:4f6c30876dfa 6 * @date 26-June-2015
Kojto 107:4f6c30876dfa 7 * @brief Header file of TSC HAL module.
Kojto 107:4f6c30876dfa 8 ******************************************************************************
Kojto 107:4f6c30876dfa 9 * @attention
Kojto 107:4f6c30876dfa 10 *
Kojto 107:4f6c30876dfa 11 * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
Kojto 107:4f6c30876dfa 12 *
Kojto 107:4f6c30876dfa 13 * Redistribution and use in source and binary forms, with or without modification,
Kojto 107:4f6c30876dfa 14 * are permitted provided that the following conditions are met:
Kojto 107:4f6c30876dfa 15 * 1. Redistributions of source code must retain the above copyright notice,
Kojto 107:4f6c30876dfa 16 * this list of conditions and the following disclaimer.
Kojto 107:4f6c30876dfa 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
Kojto 107:4f6c30876dfa 18 * this list of conditions and the following disclaimer in the documentation
Kojto 107:4f6c30876dfa 19 * and/or other materials provided with the distribution.
Kojto 107:4f6c30876dfa 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
Kojto 107:4f6c30876dfa 21 * may be used to endorse or promote products derived from this software
Kojto 107:4f6c30876dfa 22 * without specific prior written permission.
Kojto 107:4f6c30876dfa 23 *
Kojto 107:4f6c30876dfa 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
Kojto 107:4f6c30876dfa 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Kojto 107:4f6c30876dfa 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
Kojto 107:4f6c30876dfa 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
Kojto 107:4f6c30876dfa 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
Kojto 107:4f6c30876dfa 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
Kojto 107:4f6c30876dfa 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
Kojto 107:4f6c30876dfa 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
Kojto 107:4f6c30876dfa 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
Kojto 107:4f6c30876dfa 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Kojto 107:4f6c30876dfa 34 *
Kojto 107:4f6c30876dfa 35 ******************************************************************************
Kojto 107:4f6c30876dfa 36 */
Kojto 107:4f6c30876dfa 37
Kojto 107:4f6c30876dfa 38 /* Define to prevent recursive inclusion -------------------------------------*/
Kojto 107:4f6c30876dfa 39 #ifndef __STM32L4xx_HAL_TSC_H
Kojto 107:4f6c30876dfa 40 #define __STM32L4xx_HAL_TSC_H
Kojto 107:4f6c30876dfa 41
Kojto 107:4f6c30876dfa 42 #ifdef __cplusplus
Kojto 107:4f6c30876dfa 43 extern "C" {
Kojto 107:4f6c30876dfa 44 #endif
Kojto 107:4f6c30876dfa 45
Kojto 107:4f6c30876dfa 46 /* Includes ------------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 47 #include "stm32l4xx_hal_def.h"
Kojto 107:4f6c30876dfa 48
Kojto 107:4f6c30876dfa 49 /** @addtogroup STM32L4xx_HAL_Driver
Kojto 107:4f6c30876dfa 50 * @{
Kojto 107:4f6c30876dfa 51 */
Kojto 107:4f6c30876dfa 52
Kojto 107:4f6c30876dfa 53 /** @addtogroup TSC
Kojto 107:4f6c30876dfa 54 * @{
Kojto 107:4f6c30876dfa 55 */
Kojto 107:4f6c30876dfa 56
Kojto 107:4f6c30876dfa 57 /* Exported types ------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 58 /** @defgroup TSC_Exported_Types TSC Exported Types
Kojto 107:4f6c30876dfa 59 * @{
Kojto 107:4f6c30876dfa 60 */
Kojto 107:4f6c30876dfa 61
Kojto 107:4f6c30876dfa 62 /**
Kojto 107:4f6c30876dfa 63 * @brief TSC state structure definition
Kojto 107:4f6c30876dfa 64 */
Kojto 107:4f6c30876dfa 65 typedef enum
Kojto 107:4f6c30876dfa 66 {
Kojto 107:4f6c30876dfa 67 HAL_TSC_STATE_RESET = 0x00, /*!< TSC registers have their reset value */
Kojto 107:4f6c30876dfa 68 HAL_TSC_STATE_READY = 0x01, /*!< TSC registers are initialized or acquisition is completed with success */
Kojto 107:4f6c30876dfa 69 HAL_TSC_STATE_BUSY = 0x02, /*!< TSC initialization or acquisition is on-going */
Kojto 107:4f6c30876dfa 70 HAL_TSC_STATE_ERROR = 0x03 /*!< Acquisition is completed with max count error */
Kojto 107:4f6c30876dfa 71 } HAL_TSC_StateTypeDef;
Kojto 107:4f6c30876dfa 72
Kojto 107:4f6c30876dfa 73 /**
Kojto 107:4f6c30876dfa 74 * @brief TSC group status structure definition
Kojto 107:4f6c30876dfa 75 */
Kojto 107:4f6c30876dfa 76 typedef enum
Kojto 107:4f6c30876dfa 77 {
Kojto 107:4f6c30876dfa 78 TSC_GROUP_ONGOING = 0x00, /*!< Acquisition on group is on-going or not started */
Kojto 107:4f6c30876dfa 79 TSC_GROUP_COMPLETED = 0x01 /*!< Acquisition on group is completed with success (no max count error) */
Kojto 107:4f6c30876dfa 80 } TSC_GroupStatusTypeDef;
Kojto 107:4f6c30876dfa 81
Kojto 107:4f6c30876dfa 82 /**
Kojto 107:4f6c30876dfa 83 * @brief TSC init structure definition
Kojto 107:4f6c30876dfa 84 */
Kojto 107:4f6c30876dfa 85 typedef struct
Kojto 107:4f6c30876dfa 86 {
Kojto 107:4f6c30876dfa 87 uint32_t CTPulseHighLength; /*!< Charge-transfer high pulse length
Kojto 107:4f6c30876dfa 88 This parameter can be a value of @ref TSC_CTPulseHL_Config */
Kojto 107:4f6c30876dfa 89 uint32_t CTPulseLowLength; /*!< Charge-transfer low pulse length
Kojto 107:4f6c30876dfa 90 This parameter can be a value of @ref TSC_CTPulseLL_Config */
Kojto 107:4f6c30876dfa 91 uint32_t SpreadSpectrum; /*!< Spread spectrum activation
Kojto 107:4f6c30876dfa 92 This parameter can be a value of @ref TSC_CTPulseLL_Config */
Kojto 107:4f6c30876dfa 93 uint32_t SpreadSpectrumDeviation; /*!< Spread spectrum deviation
Kojto 107:4f6c30876dfa 94 This parameter must be a number between Min_Data = 0 and Max_Data = 127 */
Kojto 107:4f6c30876dfa 95 uint32_t SpreadSpectrumPrescaler; /*!< Spread spectrum prescaler
Kojto 107:4f6c30876dfa 96 This parameter can be a value of @ref TSC_SpreadSpec_Prescaler */
Kojto 107:4f6c30876dfa 97 uint32_t PulseGeneratorPrescaler; /*!< Pulse generator prescaler
Kojto 107:4f6c30876dfa 98 This parameter can be a value of @ref TSC_PulseGenerator_Prescaler */
Kojto 107:4f6c30876dfa 99 uint32_t MaxCountValue; /*!< Max count value
Kojto 107:4f6c30876dfa 100 This parameter can be a value of @ref TSC_MaxCount_Value */
Kojto 107:4f6c30876dfa 101 uint32_t IODefaultMode; /*!< IO default mode
Kojto 107:4f6c30876dfa 102 This parameter can be a value of @ref TSC_IO_Default_Mode */
Kojto 107:4f6c30876dfa 103 uint32_t SynchroPinPolarity; /*!< Synchro pin polarity
Kojto 107:4f6c30876dfa 104 This parameter can be a value of @ref TSC_Synchro_Pin_Polarity */
Kojto 107:4f6c30876dfa 105 uint32_t AcquisitionMode; /*!< Acquisition mode
Kojto 107:4f6c30876dfa 106 This parameter can be a value of @ref TSC_Acquisition_Mode */
Kojto 107:4f6c30876dfa 107 uint32_t MaxCountInterrupt; /*!< Max count interrupt activation
Kojto 107:4f6c30876dfa 108 This parameter can be set to ENABLE or DISABLE. */
Kojto 107:4f6c30876dfa 109 uint32_t ChannelIOs; /*!< Channel IOs mask */
Kojto 107:4f6c30876dfa 110 uint32_t ShieldIOs; /*!< Shield IOs mask */
Kojto 107:4f6c30876dfa 111 uint32_t SamplingIOs; /*!< Sampling IOs mask */
Kojto 107:4f6c30876dfa 112 } TSC_InitTypeDef;
Kojto 107:4f6c30876dfa 113
Kojto 107:4f6c30876dfa 114 /**
Kojto 107:4f6c30876dfa 115 * @brief TSC IOs configuration structure definition
Kojto 107:4f6c30876dfa 116 */
Kojto 107:4f6c30876dfa 117 typedef struct
Kojto 107:4f6c30876dfa 118 {
Kojto 107:4f6c30876dfa 119 uint32_t ChannelIOs; /*!< Channel IOs mask */
Kojto 107:4f6c30876dfa 120 uint32_t ShieldIOs; /*!< Shield IOs mask */
Kojto 107:4f6c30876dfa 121 uint32_t SamplingIOs; /*!< Sampling IOs mask */
Kojto 107:4f6c30876dfa 122 } TSC_IOConfigTypeDef;
Kojto 107:4f6c30876dfa 123
Kojto 107:4f6c30876dfa 124 /**
Kojto 107:4f6c30876dfa 125 * @brief TSC handle Structure definition
Kojto 107:4f6c30876dfa 126 */
Kojto 107:4f6c30876dfa 127 typedef struct
Kojto 107:4f6c30876dfa 128 {
Kojto 107:4f6c30876dfa 129 TSC_TypeDef *Instance; /*!< Register base address */
Kojto 107:4f6c30876dfa 130 TSC_InitTypeDef Init; /*!< Initialization parameters */
Kojto 107:4f6c30876dfa 131 __IO HAL_TSC_StateTypeDef State; /*!< Peripheral state */
Kojto 107:4f6c30876dfa 132 HAL_LockTypeDef Lock; /*!< Lock feature */
Kojto 107:4f6c30876dfa 133 } TSC_HandleTypeDef;
Kojto 107:4f6c30876dfa 134
Kojto 107:4f6c30876dfa 135 /**
Kojto 107:4f6c30876dfa 136 * @}
Kojto 107:4f6c30876dfa 137 */
Kojto 107:4f6c30876dfa 138
Kojto 107:4f6c30876dfa 139 /* Exported constants --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 140 /** @defgroup TSC_Exported_Constants TSC Exported Constants
Kojto 107:4f6c30876dfa 141 * @{
Kojto 107:4f6c30876dfa 142 */
Kojto 107:4f6c30876dfa 143
Kojto 107:4f6c30876dfa 144 /** @defgroup TSC_CTPulseHL_Config CTPulse High Length
Kojto 107:4f6c30876dfa 145 * @{
Kojto 107:4f6c30876dfa 146 */
Kojto 107:4f6c30876dfa 147 #define TSC_CTPH_1CYCLE ((uint32_t)((uint32_t) 0 << 28))
Kojto 107:4f6c30876dfa 148 #define TSC_CTPH_2CYCLES ((uint32_t)((uint32_t) 1 << 28))
Kojto 107:4f6c30876dfa 149 #define TSC_CTPH_3CYCLES ((uint32_t)((uint32_t) 2 << 28))
Kojto 107:4f6c30876dfa 150 #define TSC_CTPH_4CYCLES ((uint32_t)((uint32_t) 3 << 28))
Kojto 107:4f6c30876dfa 151 #define TSC_CTPH_5CYCLES ((uint32_t)((uint32_t) 4 << 28))
Kojto 107:4f6c30876dfa 152 #define TSC_CTPH_6CYCLES ((uint32_t)((uint32_t) 5 << 28))
Kojto 107:4f6c30876dfa 153 #define TSC_CTPH_7CYCLES ((uint32_t)((uint32_t) 6 << 28))
Kojto 107:4f6c30876dfa 154 #define TSC_CTPH_8CYCLES ((uint32_t)((uint32_t) 7 << 28))
Kojto 107:4f6c30876dfa 155 #define TSC_CTPH_9CYCLES ((uint32_t)((uint32_t) 8 << 28))
Kojto 107:4f6c30876dfa 156 #define TSC_CTPH_10CYCLES ((uint32_t)((uint32_t) 9 << 28))
Kojto 107:4f6c30876dfa 157 #define TSC_CTPH_11CYCLES ((uint32_t)((uint32_t)10 << 28))
Kojto 107:4f6c30876dfa 158 #define TSC_CTPH_12CYCLES ((uint32_t)((uint32_t)11 << 28))
Kojto 107:4f6c30876dfa 159 #define TSC_CTPH_13CYCLES ((uint32_t)((uint32_t)12 << 28))
Kojto 107:4f6c30876dfa 160 #define TSC_CTPH_14CYCLES ((uint32_t)((uint32_t)13 << 28))
Kojto 107:4f6c30876dfa 161 #define TSC_CTPH_15CYCLES ((uint32_t)((uint32_t)14 << 28))
Kojto 107:4f6c30876dfa 162 #define TSC_CTPH_16CYCLES ((uint32_t)((uint32_t)15 << 28))
Kojto 107:4f6c30876dfa 163 /**
Kojto 107:4f6c30876dfa 164 * @}
Kojto 107:4f6c30876dfa 165 */
Kojto 107:4f6c30876dfa 166
Kojto 107:4f6c30876dfa 167 /** @defgroup TSC_CTPulseLL_Config CTPulse Low Length
Kojto 107:4f6c30876dfa 168 * @{
Kojto 107:4f6c30876dfa 169 */
Kojto 107:4f6c30876dfa 170 #define TSC_CTPL_1CYCLE ((uint32_t)((uint32_t) 0 << 24))
Kojto 107:4f6c30876dfa 171 #define TSC_CTPL_2CYCLES ((uint32_t)((uint32_t) 1 << 24))
Kojto 107:4f6c30876dfa 172 #define TSC_CTPL_3CYCLES ((uint32_t)((uint32_t) 2 << 24))
Kojto 107:4f6c30876dfa 173 #define TSC_CTPL_4CYCLES ((uint32_t)((uint32_t) 3 << 24))
Kojto 107:4f6c30876dfa 174 #define TSC_CTPL_5CYCLES ((uint32_t)((uint32_t) 4 << 24))
Kojto 107:4f6c30876dfa 175 #define TSC_CTPL_6CYCLES ((uint32_t)((uint32_t) 5 << 24))
Kojto 107:4f6c30876dfa 176 #define TSC_CTPL_7CYCLES ((uint32_t)((uint32_t) 6 << 24))
Kojto 107:4f6c30876dfa 177 #define TSC_CTPL_8CYCLES ((uint32_t)((uint32_t) 7 << 24))
Kojto 107:4f6c30876dfa 178 #define TSC_CTPL_9CYCLES ((uint32_t)((uint32_t) 8 << 24))
Kojto 107:4f6c30876dfa 179 #define TSC_CTPL_10CYCLES ((uint32_t)((uint32_t) 9 << 24))
Kojto 107:4f6c30876dfa 180 #define TSC_CTPL_11CYCLES ((uint32_t)((uint32_t)10 << 24))
Kojto 107:4f6c30876dfa 181 #define TSC_CTPL_12CYCLES ((uint32_t)((uint32_t)11 << 24))
Kojto 107:4f6c30876dfa 182 #define TSC_CTPL_13CYCLES ((uint32_t)((uint32_t)12 << 24))
Kojto 107:4f6c30876dfa 183 #define TSC_CTPL_14CYCLES ((uint32_t)((uint32_t)13 << 24))
Kojto 107:4f6c30876dfa 184 #define TSC_CTPL_15CYCLES ((uint32_t)((uint32_t)14 << 24))
Kojto 107:4f6c30876dfa 185 #define TSC_CTPL_16CYCLES ((uint32_t)((uint32_t)15 << 24))
Kojto 107:4f6c30876dfa 186 /**
Kojto 107:4f6c30876dfa 187 * @}
Kojto 107:4f6c30876dfa 188 */
Kojto 107:4f6c30876dfa 189
Kojto 107:4f6c30876dfa 190 /** @defgroup TSC_SpreadSpec_Prescaler Spread Spectrum Prescaler
Kojto 107:4f6c30876dfa 191 * @{
Kojto 107:4f6c30876dfa 192 */
Kojto 107:4f6c30876dfa 193 #define TSC_SS_PRESC_DIV1 ((uint32_t)0)
Kojto 107:4f6c30876dfa 194 #define TSC_SS_PRESC_DIV2 (TSC_CR_SSPSC)
Kojto 107:4f6c30876dfa 195 /**
Kojto 107:4f6c30876dfa 196 * @}
Kojto 107:4f6c30876dfa 197 */
Kojto 107:4f6c30876dfa 198
Kojto 107:4f6c30876dfa 199 /** @defgroup TSC_PulseGenerator_Prescaler Pulse Generator Prescaler
Kojto 107:4f6c30876dfa 200 * @{
Kojto 107:4f6c30876dfa 201 */
Kojto 107:4f6c30876dfa 202 #define TSC_PG_PRESC_DIV1 ((uint32_t)(0 << 12))
Kojto 107:4f6c30876dfa 203 #define TSC_PG_PRESC_DIV2 ((uint32_t)(1 << 12))
Kojto 107:4f6c30876dfa 204 #define TSC_PG_PRESC_DIV4 ((uint32_t)(2 << 12))
Kojto 107:4f6c30876dfa 205 #define TSC_PG_PRESC_DIV8 ((uint32_t)(3 << 12))
Kojto 107:4f6c30876dfa 206 #define TSC_PG_PRESC_DIV16 ((uint32_t)(4 << 12))
Kojto 107:4f6c30876dfa 207 #define TSC_PG_PRESC_DIV32 ((uint32_t)(5 << 12))
Kojto 107:4f6c30876dfa 208 #define TSC_PG_PRESC_DIV64 ((uint32_t)(6 << 12))
Kojto 107:4f6c30876dfa 209 #define TSC_PG_PRESC_DIV128 ((uint32_t)(7 << 12))
Kojto 107:4f6c30876dfa 210 /**
Kojto 107:4f6c30876dfa 211 * @}
Kojto 107:4f6c30876dfa 212 */
Kojto 107:4f6c30876dfa 213
Kojto 107:4f6c30876dfa 214 /** @defgroup TSC_MaxCount_Value Max Count Value
Kojto 107:4f6c30876dfa 215 * @{
Kojto 107:4f6c30876dfa 216 */
Kojto 107:4f6c30876dfa 217 #define TSC_MCV_255 ((uint32_t)(0 << 5))
Kojto 107:4f6c30876dfa 218 #define TSC_MCV_511 ((uint32_t)(1 << 5))
Kojto 107:4f6c30876dfa 219 #define TSC_MCV_1023 ((uint32_t)(2 << 5))
Kojto 107:4f6c30876dfa 220 #define TSC_MCV_2047 ((uint32_t)(3 << 5))
Kojto 107:4f6c30876dfa 221 #define TSC_MCV_4095 ((uint32_t)(4 << 5))
Kojto 107:4f6c30876dfa 222 #define TSC_MCV_8191 ((uint32_t)(5 << 5))
Kojto 107:4f6c30876dfa 223 #define TSC_MCV_16383 ((uint32_t)(6 << 5))
Kojto 107:4f6c30876dfa 224 /**
Kojto 107:4f6c30876dfa 225 * @}
Kojto 107:4f6c30876dfa 226 */
Kojto 107:4f6c30876dfa 227
Kojto 107:4f6c30876dfa 228 /** @defgroup TSC_IO_Default_Mode IO Default Mode
Kojto 107:4f6c30876dfa 229 * @{
Kojto 107:4f6c30876dfa 230 */
Kojto 107:4f6c30876dfa 231 #define TSC_IODEF_OUT_PP_LOW ((uint32_t)0)
Kojto 107:4f6c30876dfa 232 #define TSC_IODEF_IN_FLOAT (TSC_CR_IODEF)
Kojto 107:4f6c30876dfa 233 /**
Kojto 107:4f6c30876dfa 234 * @}
Kojto 107:4f6c30876dfa 235 */
Kojto 107:4f6c30876dfa 236
Kojto 107:4f6c30876dfa 237 /** @defgroup TSC_Synchro_Pin_Polarity Synchro Pin Polarity
Kojto 107:4f6c30876dfa 238 * @{
Kojto 107:4f6c30876dfa 239 */
Kojto 107:4f6c30876dfa 240 #define TSC_SYNC_POLARITY_FALLING ((uint32_t)0)
Kojto 107:4f6c30876dfa 241 #define TSC_SYNC_POLARITY_RISING (TSC_CR_SYNCPOL)
Kojto 107:4f6c30876dfa 242 /**
Kojto 107:4f6c30876dfa 243 * @}
Kojto 107:4f6c30876dfa 244 */
Kojto 107:4f6c30876dfa 245
Kojto 107:4f6c30876dfa 246 /** @defgroup TSC_Acquisition_Mode Acquisition Mode
Kojto 107:4f6c30876dfa 247 * @{
Kojto 107:4f6c30876dfa 248 */
Kojto 107:4f6c30876dfa 249 #define TSC_ACQ_MODE_NORMAL ((uint32_t)0)
Kojto 107:4f6c30876dfa 250 #define TSC_ACQ_MODE_SYNCHRO (TSC_CR_AM)
Kojto 107:4f6c30876dfa 251 /**
Kojto 107:4f6c30876dfa 252 * @}
Kojto 107:4f6c30876dfa 253 */
Kojto 107:4f6c30876dfa 254
Kojto 107:4f6c30876dfa 255 /** @defgroup TSC_IO_Mode IO Mode
Kojto 107:4f6c30876dfa 256 * @{
Kojto 107:4f6c30876dfa 257 */
Kojto 107:4f6c30876dfa 258 #define TSC_IOMODE_UNUSED ((uint32_t)0)
Kojto 107:4f6c30876dfa 259 #define TSC_IOMODE_CHANNEL ((uint32_t)1)
Kojto 107:4f6c30876dfa 260 #define TSC_IOMODE_SHIELD ((uint32_t)2)
Kojto 107:4f6c30876dfa 261 #define TSC_IOMODE_SAMPLING ((uint32_t)3)
Kojto 107:4f6c30876dfa 262 /**
Kojto 107:4f6c30876dfa 263 * @}
Kojto 107:4f6c30876dfa 264 */
Kojto 107:4f6c30876dfa 265
Kojto 107:4f6c30876dfa 266 /** @defgroup TSC_interrupts_definition Interrupts definition
Kojto 107:4f6c30876dfa 267 * @{
Kojto 107:4f6c30876dfa 268 */
Kojto 107:4f6c30876dfa 269 #define TSC_IT_EOA ((uint32_t)TSC_IER_EOAIE)
Kojto 107:4f6c30876dfa 270 #define TSC_IT_MCE ((uint32_t)TSC_IER_MCEIE)
Kojto 107:4f6c30876dfa 271 /**
Kojto 107:4f6c30876dfa 272 * @}
Kojto 107:4f6c30876dfa 273 */
Kojto 107:4f6c30876dfa 274
Kojto 107:4f6c30876dfa 275 /** @defgroup TSC_flags_definition Flags definition
Kojto 107:4f6c30876dfa 276 * @{
Kojto 107:4f6c30876dfa 277 */
Kojto 107:4f6c30876dfa 278 #define TSC_FLAG_EOA ((uint32_t)TSC_ISR_EOAF)
Kojto 107:4f6c30876dfa 279 #define TSC_FLAG_MCE ((uint32_t)TSC_ISR_MCEF)
Kojto 107:4f6c30876dfa 280 /**
Kojto 107:4f6c30876dfa 281 * @}
Kojto 107:4f6c30876dfa 282 */
Kojto 107:4f6c30876dfa 283
Kojto 107:4f6c30876dfa 284 /** @defgroup TSC_Group_definition Group definition
Kojto 107:4f6c30876dfa 285 * @{
Kojto 107:4f6c30876dfa 286 */
Kojto 107:4f6c30876dfa 287 #define TSC_NB_OF_GROUPS (8)
Kojto 107:4f6c30876dfa 288
Kojto 107:4f6c30876dfa 289 #define TSC_GROUP1 ((uint32_t)0x00000001)
Kojto 107:4f6c30876dfa 290 #define TSC_GROUP2 ((uint32_t)0x00000002)
Kojto 107:4f6c30876dfa 291 #define TSC_GROUP3 ((uint32_t)0x00000004)
Kojto 107:4f6c30876dfa 292 #define TSC_GROUP4 ((uint32_t)0x00000008)
Kojto 107:4f6c30876dfa 293 #define TSC_GROUP5 ((uint32_t)0x00000010)
Kojto 107:4f6c30876dfa 294 #define TSC_GROUP6 ((uint32_t)0x00000020)
Kojto 107:4f6c30876dfa 295 #define TSC_GROUP7 ((uint32_t)0x00000040)
Kojto 107:4f6c30876dfa 296 #define TSC_GROUP8 ((uint32_t)0x00000080)
Kojto 107:4f6c30876dfa 297 #define TSC_ALL_GROUPS ((uint32_t)0x000000FF)
Kojto 107:4f6c30876dfa 298
Kojto 107:4f6c30876dfa 299 #define TSC_GROUP1_IDX ((uint32_t)0)
Kojto 107:4f6c30876dfa 300 #define TSC_GROUP2_IDX ((uint32_t)1)
Kojto 107:4f6c30876dfa 301 #define TSC_GROUP3_IDX ((uint32_t)2)
Kojto 107:4f6c30876dfa 302 #define TSC_GROUP4_IDX ((uint32_t)3)
Kojto 107:4f6c30876dfa 303 #define TSC_GROUP5_IDX ((uint32_t)4)
Kojto 107:4f6c30876dfa 304 #define TSC_GROUP6_IDX ((uint32_t)5)
Kojto 107:4f6c30876dfa 305 #define TSC_GROUP7_IDX ((uint32_t)6)
Kojto 107:4f6c30876dfa 306 #define TSC_GROUP8_IDX ((uint32_t)7)
Kojto 107:4f6c30876dfa 307
Kojto 107:4f6c30876dfa 308 #define TSC_GROUP1_IO1 ((uint32_t)0x00000001)
Kojto 107:4f6c30876dfa 309 #define TSC_GROUP1_IO2 ((uint32_t)0x00000002)
Kojto 107:4f6c30876dfa 310 #define TSC_GROUP1_IO3 ((uint32_t)0x00000004)
Kojto 107:4f6c30876dfa 311 #define TSC_GROUP1_IO4 ((uint32_t)0x00000008)
Kojto 107:4f6c30876dfa 312 #define TSC_GROUP1_ALL_IOS ((uint32_t)0x0000000F)
Kojto 107:4f6c30876dfa 313
Kojto 107:4f6c30876dfa 314 #define TSC_GROUP2_IO1 ((uint32_t)0x00000010)
Kojto 107:4f6c30876dfa 315 #define TSC_GROUP2_IO2 ((uint32_t)0x00000020)
Kojto 107:4f6c30876dfa 316 #define TSC_GROUP2_IO3 ((uint32_t)0x00000040)
Kojto 107:4f6c30876dfa 317 #define TSC_GROUP2_IO4 ((uint32_t)0x00000080)
Kojto 107:4f6c30876dfa 318 #define TSC_GROUP2_ALL_IOS ((uint32_t)0x000000F0)
Kojto 107:4f6c30876dfa 319
Kojto 107:4f6c30876dfa 320 #define TSC_GROUP3_IO1 ((uint32_t)0x00000100)
Kojto 107:4f6c30876dfa 321 #define TSC_GROUP3_IO2 ((uint32_t)0x00000200)
Kojto 107:4f6c30876dfa 322 #define TSC_GROUP3_IO3 ((uint32_t)0x00000400)
Kojto 107:4f6c30876dfa 323 #define TSC_GROUP3_IO4 ((uint32_t)0x00000800)
Kojto 107:4f6c30876dfa 324 #define TSC_GROUP3_ALL_IOS ((uint32_t)0x00000F00)
Kojto 107:4f6c30876dfa 325
Kojto 107:4f6c30876dfa 326 #define TSC_GROUP4_IO1 ((uint32_t)0x00001000)
Kojto 107:4f6c30876dfa 327 #define TSC_GROUP4_IO2 ((uint32_t)0x00002000)
Kojto 107:4f6c30876dfa 328 #define TSC_GROUP4_IO3 ((uint32_t)0x00004000)
Kojto 107:4f6c30876dfa 329 #define TSC_GROUP4_IO4 ((uint32_t)0x00008000)
Kojto 107:4f6c30876dfa 330 #define TSC_GROUP4_ALL_IOS ((uint32_t)0x0000F000)
Kojto 107:4f6c30876dfa 331
Kojto 107:4f6c30876dfa 332 #define TSC_GROUP5_IO1 ((uint32_t)0x00010000)
Kojto 107:4f6c30876dfa 333 #define TSC_GROUP5_IO2 ((uint32_t)0x00020000)
Kojto 107:4f6c30876dfa 334 #define TSC_GROUP5_IO3 ((uint32_t)0x00040000)
Kojto 107:4f6c30876dfa 335 #define TSC_GROUP5_IO4 ((uint32_t)0x00080000)
Kojto 107:4f6c30876dfa 336 #define TSC_GROUP5_ALL_IOS ((uint32_t)0x000F0000)
Kojto 107:4f6c30876dfa 337
Kojto 107:4f6c30876dfa 338 #define TSC_GROUP6_IO1 ((uint32_t)0x00100000)
Kojto 107:4f6c30876dfa 339 #define TSC_GROUP6_IO2 ((uint32_t)0x00200000)
Kojto 107:4f6c30876dfa 340 #define TSC_GROUP6_IO3 ((uint32_t)0x00400000)
Kojto 107:4f6c30876dfa 341 #define TSC_GROUP6_IO4 ((uint32_t)0x00800000)
Kojto 107:4f6c30876dfa 342 #define TSC_GROUP6_ALL_IOS ((uint32_t)0x00F00000)
Kojto 107:4f6c30876dfa 343
Kojto 107:4f6c30876dfa 344 #define TSC_GROUP7_IO1 ((uint32_t)0x01000000)
Kojto 107:4f6c30876dfa 345 #define TSC_GROUP7_IO2 ((uint32_t)0x02000000)
Kojto 107:4f6c30876dfa 346 #define TSC_GROUP7_IO3 ((uint32_t)0x04000000)
Kojto 107:4f6c30876dfa 347 #define TSC_GROUP7_IO4 ((uint32_t)0x08000000)
Kojto 107:4f6c30876dfa 348 #define TSC_GROUP7_ALL_IOS ((uint32_t)0x0F000000)
Kojto 107:4f6c30876dfa 349
Kojto 107:4f6c30876dfa 350 #define TSC_GROUP8_IO1 ((uint32_t)0x10000000)
Kojto 107:4f6c30876dfa 351 #define TSC_GROUP8_IO2 ((uint32_t)0x20000000)
Kojto 107:4f6c30876dfa 352 #define TSC_GROUP8_IO3 ((uint32_t)0x40000000)
Kojto 107:4f6c30876dfa 353 #define TSC_GROUP8_IO4 ((uint32_t)0x80000000)
Kojto 107:4f6c30876dfa 354 #define TSC_GROUP8_ALL_IOS ((uint32_t)0xF0000000)
Kojto 107:4f6c30876dfa 355
Kojto 107:4f6c30876dfa 356 #define TSC_ALL_GROUPS_ALL_IOS ((uint32_t)0xFFFFFFFF)
Kojto 107:4f6c30876dfa 357 /**
Kojto 107:4f6c30876dfa 358 * @}
Kojto 107:4f6c30876dfa 359 */
Kojto 107:4f6c30876dfa 360
Kojto 107:4f6c30876dfa 361 /**
Kojto 107:4f6c30876dfa 362 * @}
Kojto 107:4f6c30876dfa 363 */
Kojto 107:4f6c30876dfa 364
Kojto 107:4f6c30876dfa 365 /* Exported macros -----------------------------------------------------------*/
Kojto 107:4f6c30876dfa 366
Kojto 107:4f6c30876dfa 367 /** @defgroup TSC_Exported_Macros TSC Exported Macros
Kojto 107:4f6c30876dfa 368 * @{
Kojto 107:4f6c30876dfa 369 */
Kojto 107:4f6c30876dfa 370
Kojto 107:4f6c30876dfa 371 /** @brief Reset TSC handle state.
Kojto 107:4f6c30876dfa 372 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 373 * @retval None
Kojto 107:4f6c30876dfa 374 */
Kojto 107:4f6c30876dfa 375 #define __HAL_TSC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_TSC_STATE_RESET)
Kojto 107:4f6c30876dfa 376
Kojto 107:4f6c30876dfa 377 /**
Kojto 107:4f6c30876dfa 378 * @brief Enable the TSC peripheral.
Kojto 107:4f6c30876dfa 379 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 380 * @retval None
Kojto 107:4f6c30876dfa 381 */
Kojto 107:4f6c30876dfa 382 #define __HAL_TSC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= TSC_CR_TSCE)
Kojto 107:4f6c30876dfa 383
Kojto 107:4f6c30876dfa 384 /**
Kojto 107:4f6c30876dfa 385 * @brief Disable the TSC peripheral.
Kojto 107:4f6c30876dfa 386 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 387 * @retval None
Kojto 107:4f6c30876dfa 388 */
Kojto 107:4f6c30876dfa 389 #define __HAL_TSC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= (uint32_t)(~TSC_CR_TSCE))
Kojto 107:4f6c30876dfa 390
Kojto 107:4f6c30876dfa 391 /**
Kojto 107:4f6c30876dfa 392 * @brief Start acquisition.
Kojto 107:4f6c30876dfa 393 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 394 * @retval None
Kojto 107:4f6c30876dfa 395 */
Kojto 107:4f6c30876dfa 396 #define __HAL_TSC_START_ACQ(__HANDLE__) ((__HANDLE__)->Instance->CR |= TSC_CR_START)
Kojto 107:4f6c30876dfa 397
Kojto 107:4f6c30876dfa 398 /**
Kojto 107:4f6c30876dfa 399 * @brief Stop acquisition.
Kojto 107:4f6c30876dfa 400 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 401 * @retval None
Kojto 107:4f6c30876dfa 402 */
Kojto 107:4f6c30876dfa 403 #define __HAL_TSC_STOP_ACQ(__HANDLE__) ((__HANDLE__)->Instance->CR &= (uint32_t)(~TSC_CR_START))
Kojto 107:4f6c30876dfa 404
Kojto 107:4f6c30876dfa 405 /**
Kojto 107:4f6c30876dfa 406 * @brief Set IO default mode to output push-pull low.
Kojto 107:4f6c30876dfa 407 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 408 * @retval None
Kojto 107:4f6c30876dfa 409 */
Kojto 107:4f6c30876dfa 410 #define __HAL_TSC_SET_IODEF_OUTPPLOW(__HANDLE__) ((__HANDLE__)->Instance->CR &= (uint32_t)(~TSC_CR_IODEF))
Kojto 107:4f6c30876dfa 411
Kojto 107:4f6c30876dfa 412 /**
Kojto 107:4f6c30876dfa 413 * @brief Set IO default mode to input floating.
Kojto 107:4f6c30876dfa 414 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 415 * @retval None
Kojto 107:4f6c30876dfa 416 */
Kojto 107:4f6c30876dfa 417 #define __HAL_TSC_SET_IODEF_INFLOAT(__HANDLE__) ((__HANDLE__)->Instance->CR |= TSC_CR_IODEF)
Kojto 107:4f6c30876dfa 418
Kojto 107:4f6c30876dfa 419 /**
Kojto 107:4f6c30876dfa 420 * @brief Set synchronization polarity to falling edge.
Kojto 107:4f6c30876dfa 421 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 422 * @retval None
Kojto 107:4f6c30876dfa 423 */
Kojto 107:4f6c30876dfa 424 #define __HAL_TSC_SET_SYNC_POL_FALL(__HANDLE__) ((__HANDLE__)->Instance->CR &= (uint32_t)(~TSC_CR_SYNCPOL))
Kojto 107:4f6c30876dfa 425
Kojto 107:4f6c30876dfa 426 /**
Kojto 107:4f6c30876dfa 427 * @brief Set synchronization polarity to rising edge and high level.
Kojto 107:4f6c30876dfa 428 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 429 * @retval None
Kojto 107:4f6c30876dfa 430 */
Kojto 107:4f6c30876dfa 431 #define __HAL_TSC_SET_SYNC_POL_RISE_HIGH(__HANDLE__) ((__HANDLE__)->Instance->CR |= TSC_CR_SYNCPOL)
Kojto 107:4f6c30876dfa 432
Kojto 107:4f6c30876dfa 433 /**
Kojto 107:4f6c30876dfa 434 * @brief Enable TSC interrupt.
Kojto 107:4f6c30876dfa 435 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 436 * @param __INTERRUPT__: TSC interrupt
Kojto 107:4f6c30876dfa 437 * @retval None
Kojto 107:4f6c30876dfa 438 */
Kojto 107:4f6c30876dfa 439 #define __HAL_TSC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
Kojto 107:4f6c30876dfa 440
Kojto 107:4f6c30876dfa 441 /**
Kojto 107:4f6c30876dfa 442 * @brief Disable TSC interrupt.
Kojto 107:4f6c30876dfa 443 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 444 * @param __INTERRUPT__: TSC interrupt
Kojto 107:4f6c30876dfa 445 * @retval None
Kojto 107:4f6c30876dfa 446 */
Kojto 107:4f6c30876dfa 447 #define __HAL_TSC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (uint32_t)(~(__INTERRUPT__)))
Kojto 107:4f6c30876dfa 448
Kojto 107:4f6c30876dfa 449 /** @brief Check whether the specified TSC interrupt source is enabled or not.
Kojto 107:4f6c30876dfa 450 * @param __HANDLE__: TSC Handle
Kojto 107:4f6c30876dfa 451 * @param __INTERRUPT__: TSC interrupt
Kojto 107:4f6c30876dfa 452 * @retval SET or RESET
Kojto 107:4f6c30876dfa 453 */
Kojto 107:4f6c30876dfa 454 #define __HAL_TSC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
Kojto 107:4f6c30876dfa 455
Kojto 107:4f6c30876dfa 456 /**
Kojto 107:4f6c30876dfa 457 * @brief Check whether the specified TSC flag is set or not.
Kojto 107:4f6c30876dfa 458 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 459 * @param __FLAG__: TSC flag
Kojto 107:4f6c30876dfa 460 * @retval SET or RESET
Kojto 107:4f6c30876dfa 461 */
Kojto 107:4f6c30876dfa 462 #define __HAL_TSC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__)) ? SET : RESET)
Kojto 107:4f6c30876dfa 463
Kojto 107:4f6c30876dfa 464 /**
Kojto 107:4f6c30876dfa 465 * @brief Clear the TSC's pending flag.
Kojto 107:4f6c30876dfa 466 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 467 * @param __FLAG__: TSC flag
Kojto 107:4f6c30876dfa 468 * @retval None
Kojto 107:4f6c30876dfa 469 */
Kojto 107:4f6c30876dfa 470 #define __HAL_TSC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
Kojto 107:4f6c30876dfa 471
Kojto 107:4f6c30876dfa 472 /**
Kojto 107:4f6c30876dfa 473 * @brief Enable schmitt trigger hysteresis on a group of IOs.
Kojto 107:4f6c30876dfa 474 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 475 * @param __GX_IOY_MASK__: IOs mask
Kojto 107:4f6c30876dfa 476 * @retval None
Kojto 107:4f6c30876dfa 477 */
Kojto 107:4f6c30876dfa 478 #define __HAL_TSC_ENABLE_HYSTERESIS(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOHCR |= (__GX_IOY_MASK__))
Kojto 107:4f6c30876dfa 479
Kojto 107:4f6c30876dfa 480 /**
Kojto 107:4f6c30876dfa 481 * @brief Disable schmitt trigger hysteresis on a group of IOs.
Kojto 107:4f6c30876dfa 482 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 483 * @param __GX_IOY_MASK__: IOs mask
Kojto 107:4f6c30876dfa 484 * @retval None
Kojto 107:4f6c30876dfa 485 */
Kojto 107:4f6c30876dfa 486 #define __HAL_TSC_DISABLE_HYSTERESIS(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOHCR &= (uint32_t)(~(__GX_IOY_MASK__)))
Kojto 107:4f6c30876dfa 487
Kojto 107:4f6c30876dfa 488 /**
Kojto 107:4f6c30876dfa 489 * @brief Open analog switch on a group of IOs.
Kojto 107:4f6c30876dfa 490 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 491 * @param __GX_IOY_MASK__: IOs mask
Kojto 107:4f6c30876dfa 492 * @retval None
Kojto 107:4f6c30876dfa 493 */
Kojto 107:4f6c30876dfa 494 #define __HAL_TSC_OPEN_ANALOG_SWITCH(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOASCR &= (uint32_t)(~(__GX_IOY_MASK__)))
Kojto 107:4f6c30876dfa 495
Kojto 107:4f6c30876dfa 496 /**
Kojto 107:4f6c30876dfa 497 * @brief Close analog switch on a group of IOs.
Kojto 107:4f6c30876dfa 498 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 499 * @param __GX_IOY_MASK__: IOs mask
Kojto 107:4f6c30876dfa 500 * @retval None
Kojto 107:4f6c30876dfa 501 */
Kojto 107:4f6c30876dfa 502 #define __HAL_TSC_CLOSE_ANALOG_SWITCH(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOASCR |= (__GX_IOY_MASK__))
Kojto 107:4f6c30876dfa 503
Kojto 107:4f6c30876dfa 504 /**
Kojto 107:4f6c30876dfa 505 * @brief Enable a group of IOs in channel mode.
Kojto 107:4f6c30876dfa 506 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 507 * @param __GX_IOY_MASK__: IOs mask
Kojto 107:4f6c30876dfa 508 * @retval None
Kojto 107:4f6c30876dfa 509 */
Kojto 107:4f6c30876dfa 510 #define __HAL_TSC_ENABLE_CHANNEL(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOCCR |= (__GX_IOY_MASK__))
Kojto 107:4f6c30876dfa 511
Kojto 107:4f6c30876dfa 512 /**
Kojto 107:4f6c30876dfa 513 * @brief Disable a group of channel IOs.
Kojto 107:4f6c30876dfa 514 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 515 * @param __GX_IOY_MASK__: IOs mask
Kojto 107:4f6c30876dfa 516 * @retval None
Kojto 107:4f6c30876dfa 517 */
Kojto 107:4f6c30876dfa 518 #define __HAL_TSC_DISABLE_CHANNEL(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOCCR &= (uint32_t)(~(__GX_IOY_MASK__)))
Kojto 107:4f6c30876dfa 519
Kojto 107:4f6c30876dfa 520 /**
Kojto 107:4f6c30876dfa 521 * @brief Enable a group of IOs in sampling mode.
Kojto 107:4f6c30876dfa 522 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 523 * @param __GX_IOY_MASK__: IOs mask
Kojto 107:4f6c30876dfa 524 * @retval None
Kojto 107:4f6c30876dfa 525 */
Kojto 107:4f6c30876dfa 526 #define __HAL_TSC_ENABLE_SAMPLING(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOSCR |= (__GX_IOY_MASK__))
Kojto 107:4f6c30876dfa 527
Kojto 107:4f6c30876dfa 528 /**
Kojto 107:4f6c30876dfa 529 * @brief Disable a group of sampling IOs.
Kojto 107:4f6c30876dfa 530 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 531 * @param __GX_IOY_MASK__: IOs mask
Kojto 107:4f6c30876dfa 532 * @retval None
Kojto 107:4f6c30876dfa 533 */
Kojto 107:4f6c30876dfa 534 #define __HAL_TSC_DISABLE_SAMPLING(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOSCR &= (uint32_t)(~(__GX_IOY_MASK__)))
Kojto 107:4f6c30876dfa 535
Kojto 107:4f6c30876dfa 536 /**
Kojto 107:4f6c30876dfa 537 * @brief Enable acquisition groups.
Kojto 107:4f6c30876dfa 538 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 539 * @param __GX_MASK__: Groups mask
Kojto 107:4f6c30876dfa 540 * @retval None
Kojto 107:4f6c30876dfa 541 */
Kojto 107:4f6c30876dfa 542 #define __HAL_TSC_ENABLE_GROUP(__HANDLE__, __GX_MASK__) ((__HANDLE__)->Instance->IOGCSR |= (__GX_MASK__))
Kojto 107:4f6c30876dfa 543
Kojto 107:4f6c30876dfa 544 /**
Kojto 107:4f6c30876dfa 545 * @brief Disable acquisition groups.
Kojto 107:4f6c30876dfa 546 * @param __HANDLE__: TSC handle
Kojto 107:4f6c30876dfa 547 * @param __GX_MASK__: Groups mask
Kojto 107:4f6c30876dfa 548 * @retval None
Kojto 107:4f6c30876dfa 549 */
Kojto 107:4f6c30876dfa 550 #define __HAL_TSC_DISABLE_GROUP(__HANDLE__, __GX_MASK__) ((__HANDLE__)->Instance->IOGCSR &= (uint32_t)(~(__GX_MASK__)))
Kojto 107:4f6c30876dfa 551
Kojto 107:4f6c30876dfa 552 /** @brief Gets acquisition group status.
Kojto 107:4f6c30876dfa 553 * @param __HANDLE__: TSC Handle
Kojto 107:4f6c30876dfa 554 * @param __GX_INDEX__: Group index
Kojto 107:4f6c30876dfa 555 * @retval SET or RESET
Kojto 107:4f6c30876dfa 556 */
Kojto 107:4f6c30876dfa 557 #define __HAL_TSC_GET_GROUP_STATUS(__HANDLE__, __GX_INDEX__) \
Kojto 107:4f6c30876dfa 558 ((((__HANDLE__)->Instance->IOGCSR & (uint32_t)((uint32_t)1 << ((__GX_INDEX__) + (uint32_t)16))) == (uint32_t)((uint32_t)1 << ((__GX_INDEX__) + (uint32_t)16))) ? TSC_GROUP_COMPLETED : TSC_GROUP_ONGOING)
Kojto 107:4f6c30876dfa 559
Kojto 107:4f6c30876dfa 560 /**
Kojto 107:4f6c30876dfa 561 * @}
Kojto 107:4f6c30876dfa 562 */
Kojto 107:4f6c30876dfa 563
Kojto 107:4f6c30876dfa 564 /* Private macros ------------------------------------------------------------*/
Kojto 107:4f6c30876dfa 565
Kojto 107:4f6c30876dfa 566 /** @defgroup TSC_Private_Macros TSC Private Macros
Kojto 107:4f6c30876dfa 567 * @{
Kojto 107:4f6c30876dfa 568 */
Kojto 107:4f6c30876dfa 569
Kojto 107:4f6c30876dfa 570 #define IS_TSC_CTPH(VAL) (((VAL) == TSC_CTPH_1CYCLE) || \
Kojto 107:4f6c30876dfa 571 ((VAL) == TSC_CTPH_2CYCLES) || \
Kojto 107:4f6c30876dfa 572 ((VAL) == TSC_CTPH_3CYCLES) || \
Kojto 107:4f6c30876dfa 573 ((VAL) == TSC_CTPH_4CYCLES) || \
Kojto 107:4f6c30876dfa 574 ((VAL) == TSC_CTPH_5CYCLES) || \
Kojto 107:4f6c30876dfa 575 ((VAL) == TSC_CTPH_6CYCLES) || \
Kojto 107:4f6c30876dfa 576 ((VAL) == TSC_CTPH_7CYCLES) || \
Kojto 107:4f6c30876dfa 577 ((VAL) == TSC_CTPH_8CYCLES) || \
Kojto 107:4f6c30876dfa 578 ((VAL) == TSC_CTPH_9CYCLES) || \
Kojto 107:4f6c30876dfa 579 ((VAL) == TSC_CTPH_10CYCLES) || \
Kojto 107:4f6c30876dfa 580 ((VAL) == TSC_CTPH_11CYCLES) || \
Kojto 107:4f6c30876dfa 581 ((VAL) == TSC_CTPH_12CYCLES) || \
Kojto 107:4f6c30876dfa 582 ((VAL) == TSC_CTPH_13CYCLES) || \
Kojto 107:4f6c30876dfa 583 ((VAL) == TSC_CTPH_14CYCLES) || \
Kojto 107:4f6c30876dfa 584 ((VAL) == TSC_CTPH_15CYCLES) || \
Kojto 107:4f6c30876dfa 585 ((VAL) == TSC_CTPH_16CYCLES))
Kojto 107:4f6c30876dfa 586
Kojto 107:4f6c30876dfa 587 #define IS_TSC_CTPL(VAL) (((VAL) == TSC_CTPL_1CYCLE) || \
Kojto 107:4f6c30876dfa 588 ((VAL) == TSC_CTPL_2CYCLES) || \
Kojto 107:4f6c30876dfa 589 ((VAL) == TSC_CTPL_3CYCLES) || \
Kojto 107:4f6c30876dfa 590 ((VAL) == TSC_CTPL_4CYCLES) || \
Kojto 107:4f6c30876dfa 591 ((VAL) == TSC_CTPL_5CYCLES) || \
Kojto 107:4f6c30876dfa 592 ((VAL) == TSC_CTPL_6CYCLES) || \
Kojto 107:4f6c30876dfa 593 ((VAL) == TSC_CTPL_7CYCLES) || \
Kojto 107:4f6c30876dfa 594 ((VAL) == TSC_CTPL_8CYCLES) || \
Kojto 107:4f6c30876dfa 595 ((VAL) == TSC_CTPL_9CYCLES) || \
Kojto 107:4f6c30876dfa 596 ((VAL) == TSC_CTPL_10CYCLES) || \
Kojto 107:4f6c30876dfa 597 ((VAL) == TSC_CTPL_11CYCLES) || \
Kojto 107:4f6c30876dfa 598 ((VAL) == TSC_CTPL_12CYCLES) || \
Kojto 107:4f6c30876dfa 599 ((VAL) == TSC_CTPL_13CYCLES) || \
Kojto 107:4f6c30876dfa 600 ((VAL) == TSC_CTPL_14CYCLES) || \
Kojto 107:4f6c30876dfa 601 ((VAL) == TSC_CTPL_15CYCLES) || \
Kojto 107:4f6c30876dfa 602 ((VAL) == TSC_CTPL_16CYCLES))
Kojto 107:4f6c30876dfa 603
Kojto 107:4f6c30876dfa 604 #define IS_TSC_SS(VAL) (((VAL) == DISABLE) || ((VAL) == ENABLE))
Kojto 107:4f6c30876dfa 605
Kojto 107:4f6c30876dfa 606 #define IS_TSC_SSD(VAL) (((VAL) == 0) || (((VAL) > 0) && ((VAL) < 128)))
Kojto 107:4f6c30876dfa 607
Kojto 107:4f6c30876dfa 608 #define IS_TSC_SS_PRESC(VAL) (((VAL) == TSC_SS_PRESC_DIV1) || ((VAL) == TSC_SS_PRESC_DIV2))
Kojto 107:4f6c30876dfa 609
Kojto 107:4f6c30876dfa 610 #define IS_TSC_PG_PRESC(VAL) (((VAL) == TSC_PG_PRESC_DIV1) || \
Kojto 107:4f6c30876dfa 611 ((VAL) == TSC_PG_PRESC_DIV2) || \
Kojto 107:4f6c30876dfa 612 ((VAL) == TSC_PG_PRESC_DIV4) || \
Kojto 107:4f6c30876dfa 613 ((VAL) == TSC_PG_PRESC_DIV8) || \
Kojto 107:4f6c30876dfa 614 ((VAL) == TSC_PG_PRESC_DIV16) || \
Kojto 107:4f6c30876dfa 615 ((VAL) == TSC_PG_PRESC_DIV32) || \
Kojto 107:4f6c30876dfa 616 ((VAL) == TSC_PG_PRESC_DIV64) || \
Kojto 107:4f6c30876dfa 617 ((VAL) == TSC_PG_PRESC_DIV128))
Kojto 107:4f6c30876dfa 618
Kojto 107:4f6c30876dfa 619 #define IS_TSC_MCV(VAL) (((VAL) == TSC_MCV_255) || \
Kojto 107:4f6c30876dfa 620 ((VAL) == TSC_MCV_511) || \
Kojto 107:4f6c30876dfa 621 ((VAL) == TSC_MCV_1023) || \
Kojto 107:4f6c30876dfa 622 ((VAL) == TSC_MCV_2047) || \
Kojto 107:4f6c30876dfa 623 ((VAL) == TSC_MCV_4095) || \
Kojto 107:4f6c30876dfa 624 ((VAL) == TSC_MCV_8191) || \
Kojto 107:4f6c30876dfa 625 ((VAL) == TSC_MCV_16383))
Kojto 107:4f6c30876dfa 626
Kojto 107:4f6c30876dfa 627 #define IS_TSC_IODEF(VAL) (((VAL) == TSC_IODEF_OUT_PP_LOW) || ((VAL) == TSC_IODEF_IN_FLOAT))
Kojto 107:4f6c30876dfa 628
Kojto 107:4f6c30876dfa 629 #define IS_TSC_SYNC_POL(VAL) (((VAL) == TSC_SYNC_POLARITY_FALLING) || ((VAL) == TSC_SYNC_POLARITY_RISING))
Kojto 107:4f6c30876dfa 630
Kojto 107:4f6c30876dfa 631 #define IS_TSC_ACQ_MODE(VAL) (((VAL) == TSC_ACQ_MODE_NORMAL) || ((VAL) == TSC_ACQ_MODE_SYNCHRO))
Kojto 107:4f6c30876dfa 632
Kojto 107:4f6c30876dfa 633 #define IS_TSC_IOMODE(VAL) (((VAL) == TSC_IOMODE_UNUSED) || \
Kojto 107:4f6c30876dfa 634 ((VAL) == TSC_IOMODE_CHANNEL) || \
Kojto 107:4f6c30876dfa 635 ((VAL) == TSC_IOMODE_SHIELD) || \
Kojto 107:4f6c30876dfa 636 ((VAL) == TSC_IOMODE_SAMPLING))
Kojto 107:4f6c30876dfa 637
Kojto 107:4f6c30876dfa 638 #define IS_TSC_MCE_IT(VAL) (((VAL) == DISABLE) || ((VAL) == ENABLE))
Kojto 107:4f6c30876dfa 639
Kojto 107:4f6c30876dfa 640 #define IS_TSC_GROUP_INDEX(VAL) (((VAL) == 0) || (((VAL) > 0) && ((VAL) < TSC_NB_OF_GROUPS)))
Kojto 107:4f6c30876dfa 641
Kojto 107:4f6c30876dfa 642 /**
Kojto 107:4f6c30876dfa 643 * @}
Kojto 107:4f6c30876dfa 644 */
Kojto 107:4f6c30876dfa 645
Kojto 107:4f6c30876dfa 646 /* Exported functions --------------------------------------------------------*/
Kojto 107:4f6c30876dfa 647 /** @addtogroup TSC_Exported_Functions
Kojto 107:4f6c30876dfa 648 * @{
Kojto 107:4f6c30876dfa 649 */
Kojto 107:4f6c30876dfa 650
Kojto 107:4f6c30876dfa 651 /** @addtogroup TSC_Exported_Functions_Group1 Initialization and de-initialization functions
Kojto 107:4f6c30876dfa 652 * @{
Kojto 107:4f6c30876dfa 653 */
Kojto 107:4f6c30876dfa 654 /* Initialization and de-initialization functions *****************************/
Kojto 107:4f6c30876dfa 655 HAL_StatusTypeDef HAL_TSC_Init(TSC_HandleTypeDef* htsc);
Kojto 107:4f6c30876dfa 656 HAL_StatusTypeDef HAL_TSC_DeInit(TSC_HandleTypeDef *htsc);
Kojto 107:4f6c30876dfa 657 void HAL_TSC_MspInit(TSC_HandleTypeDef* htsc);
Kojto 107:4f6c30876dfa 658 void HAL_TSC_MspDeInit(TSC_HandleTypeDef* htsc);
Kojto 107:4f6c30876dfa 659 /**
Kojto 107:4f6c30876dfa 660 * @}
Kojto 107:4f6c30876dfa 661 */
Kojto 107:4f6c30876dfa 662
Kojto 107:4f6c30876dfa 663 /** @addtogroup TSC_Exported_Functions_Group2 Input and Output operation functions
Kojto 107:4f6c30876dfa 664 * @{
Kojto 107:4f6c30876dfa 665 */
Kojto 107:4f6c30876dfa 666 /* IO operation functions *****************************************************/
Kojto 107:4f6c30876dfa 667 HAL_StatusTypeDef HAL_TSC_Start(TSC_HandleTypeDef* htsc);
Kojto 107:4f6c30876dfa 668 HAL_StatusTypeDef HAL_TSC_Start_IT(TSC_HandleTypeDef* htsc);
Kojto 107:4f6c30876dfa 669 HAL_StatusTypeDef HAL_TSC_Stop(TSC_HandleTypeDef* htsc);
Kojto 107:4f6c30876dfa 670 HAL_StatusTypeDef HAL_TSC_Stop_IT(TSC_HandleTypeDef* htsc);
Kojto 107:4f6c30876dfa 671 HAL_StatusTypeDef HAL_TSC_PollForAcquisition(TSC_HandleTypeDef* htsc);
Kojto 107:4f6c30876dfa 672 TSC_GroupStatusTypeDef HAL_TSC_GroupGetStatus(TSC_HandleTypeDef* htsc, uint32_t gx_index);
Kojto 107:4f6c30876dfa 673 uint32_t HAL_TSC_GroupGetValue(TSC_HandleTypeDef* htsc, uint32_t gx_index);
Kojto 107:4f6c30876dfa 674 /**
Kojto 107:4f6c30876dfa 675 * @}
Kojto 107:4f6c30876dfa 676 */
Kojto 107:4f6c30876dfa 677
Kojto 107:4f6c30876dfa 678 /** @addtogroup TSC_Exported_Functions_Group3 Peripheral Control functions
Kojto 107:4f6c30876dfa 679 * @{
Kojto 107:4f6c30876dfa 680 */
Kojto 107:4f6c30876dfa 681 /* Peripheral Control functions ***********************************************/
Kojto 107:4f6c30876dfa 682 HAL_StatusTypeDef HAL_TSC_IOConfig(TSC_HandleTypeDef* htsc, TSC_IOConfigTypeDef* config);
Kojto 107:4f6c30876dfa 683 HAL_StatusTypeDef HAL_TSC_IODischarge(TSC_HandleTypeDef* htsc, uint32_t choice);
Kojto 107:4f6c30876dfa 684 /**
Kojto 107:4f6c30876dfa 685 * @}
Kojto 107:4f6c30876dfa 686 */
Kojto 107:4f6c30876dfa 687
Kojto 107:4f6c30876dfa 688 /** @addtogroup TSC_Exported_Functions_Group4 Peripheral State and Errors functions
Kojto 107:4f6c30876dfa 689 * @{
Kojto 107:4f6c30876dfa 690 */
Kojto 107:4f6c30876dfa 691 /* Peripheral State and Error functions ***************************************/
Kojto 107:4f6c30876dfa 692 HAL_TSC_StateTypeDef HAL_TSC_GetState(TSC_HandleTypeDef* htsc);
Kojto 107:4f6c30876dfa 693 /**
Kojto 107:4f6c30876dfa 694 * @}
Kojto 107:4f6c30876dfa 695 */
Kojto 107:4f6c30876dfa 696
Kojto 107:4f6c30876dfa 697 /** @addtogroup TSC_IRQ_Handler_and_Callbacks IRQ Handler and Callbacks
Kojto 107:4f6c30876dfa 698 * @{
Kojto 107:4f6c30876dfa 699 */
Kojto 107:4f6c30876dfa 700 /******* TSC IRQHandler and Callbacks used in Interrupt mode */
Kojto 107:4f6c30876dfa 701 void HAL_TSC_IRQHandler(TSC_HandleTypeDef* htsc);
Kojto 107:4f6c30876dfa 702 void HAL_TSC_ConvCpltCallback(TSC_HandleTypeDef* htsc);
Kojto 107:4f6c30876dfa 703 void HAL_TSC_ErrorCallback(TSC_HandleTypeDef* htsc);
Kojto 107:4f6c30876dfa 704 /**
Kojto 107:4f6c30876dfa 705 * @}
Kojto 107:4f6c30876dfa 706 */
Kojto 107:4f6c30876dfa 707
Kojto 107:4f6c30876dfa 708 /**
Kojto 107:4f6c30876dfa 709 * @}
Kojto 107:4f6c30876dfa 710 */
Kojto 107:4f6c30876dfa 711
Kojto 107:4f6c30876dfa 712 /**
Kojto 107:4f6c30876dfa 713 * @}
Kojto 107:4f6c30876dfa 714 */
Kojto 107:4f6c30876dfa 715
Kojto 107:4f6c30876dfa 716 /**
Kojto 107:4f6c30876dfa 717 * @}
Kojto 107:4f6c30876dfa 718 */
Kojto 107:4f6c30876dfa 719
Kojto 107:4f6c30876dfa 720 #ifdef __cplusplus
Kojto 107:4f6c30876dfa 721 }
Kojto 107:4f6c30876dfa 722 #endif
Kojto 107:4f6c30876dfa 723
Kojto 107:4f6c30876dfa 724 #endif /* __STM32L4xx_HAL_TSC_H */
Kojto 107:4f6c30876dfa 725
Kojto 107:4f6c30876dfa 726 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/