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

Fork of mbed by mbed official

Committer:
Mikchel
Date:
Sun May 03 16:04:42 2015 +0000
Revision:
99:7f6c6de930c0
Parent:
93:e188a91d3eaa
12

Who changed what in which revision?

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