mbed official / mbed

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

Committer:
Kojto
Date:
Thu Jul 07 14:34:11 2016 +0100
Revision:
122:f9eeca106725
Parent:
90:cb3d968589d8
Child:
123:b0220dba8be7
Release 122 of the mbed library

Changes:
- new targets - Nucleo L432KC, Beetle, Nucleo F446ZE, Nucleo L011K4
- Thread safety addition - mbed API should contain a statement about thread safety
- critical section API addition
- CAS API (core_util_atomic_incr/decr)
- DEVICE_ are generated from targets.json file, device.h deprecated
- Callback replaces FunctionPointer to provide std like interface
- mbed HAL API docs improvements
- toolchain - prexif attributes with MBED_
- add new attributes - packed, weak, forcedinline, align
- target.json - contains targets definitions
- ST - L1XX - Cube update to 1.5
- SPI clock selection fix (clock from APB domain)
- F7 - Cube update v1.4.0
- L0 - baudrate init fix
- L1 - Cube update v1.5
- F3 - baudrate init fix, 3 targets CAN support
- F4 - Cube update v1.12.0, 3 targets CAN support
- L4XX - Cube update v1.5.1
- F0 - update Cube to v1.5.0
- L4 - 2 targets (L476RG/VG) CAN support
- NXP - pwm clock fix for KSDK2 MCU
- LPC2368 - remove ARM toolchain support - due to regression
- KSDK2 - fix SPI , I2C address and repeat start
- Silabs - some fixes backported from mbed 3
- Renesas - RZ_A1H - SystemCoreClockUpdate addition

Who changed what in which revision?

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