meh

Fork of mbed by mbed official

Committer:
Kojto
Date:
Tue Oct 28 16:40:41 2014 +0000
Revision:
90:cb3d968589d8
Child:
93:e188a91d3eaa
Release 90 of the mbed library

Changes:

- Freescale KSDK update (v1.0)
- K22 - new target addition
- KL43Z - new target addition
- Nucleo F091RC - new target addition
- Nucleo L152RE - STM32Cube driver
- Nordic - Softdevice v7.1.0
- Nvic files - BSD License
- LPC824 - various HAL fixes
- Nucleo F411RE - CMSIS - IAR files

Who changed what in which revision?

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