mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Committer:
mbed_official
Date:
Fri Aug 14 13:15:17 2015 +0100
Revision:
610:813dcc80987e
Synchronized with git revision 6d84db41c6833e0b9b024741eb0616a5f62d5599

Full URL: https://github.com/mbedmicro/mbed/commit/6d84db41c6833e0b9b024741eb0616a5f62d5599/

DISCO_F746NG - Improvements

Who changed what in which revision?

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