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

Dependents:   1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB

Fork of mbed by mbed official

Committer:
elijahorr
Date:
Thu Apr 14 07:28:54 2016 +0000
Revision:
121:672067c3ada4
Parent:
109:9296ab0bfc11
.

Who changed what in which revision?

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