Ricardo Benitez / mbed

Fork of mbed by mbed official

Committer:
Kojto
Date:
Thu Oct 29 08:40:18 2015 +0000
Revision:
109:9296ab0bfc11
Release 109  of the mbed library

Changes:
- new platforms - NUCLEO_F042K6, WIZNWIKI_W7500ECO
- MTS targets - bootloaders update to 0.1.1
- STM F7 - RTC enable fixes
- STM F4 - i2c pending stop before start fix
- STM all targets - analogout normalization fix

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Kojto 109:9296ab0bfc11 1 /**
Kojto 109:9296ab0bfc11 2 ******************************************************************************
Kojto 109:9296ab0bfc11 3 * @file stm32f3xx_hal_tsc.h
Kojto 109:9296ab0bfc11 4 * @author MCD Application Team
Kojto 109:9296ab0bfc11 5 * @version V1.1.0
Kojto 109:9296ab0bfc11 6 * @date 12-Sept-2014
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) 2014 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 __STM32F3xx_TSC_H
Kojto 109:9296ab0bfc11 41 #define __STM32F3xx_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 /* Includes ------------------------------------------------------------------*/
Kojto 109:9296ab0bfc11 48 #include "stm32f3xx_hal_def.h"
Kojto 109:9296ab0bfc11 49
Kojto 109:9296ab0bfc11 50 /** @addtogroup STM32F3xx_HAL_Driver
Kojto 109:9296ab0bfc11 51 * @{
Kojto 109:9296ab0bfc11 52 */
Kojto 109:9296ab0bfc11 53
Kojto 109:9296ab0bfc11 54 /** @addtogroup TSC
Kojto 109:9296ab0bfc11 55 * @{
Kojto 109:9296ab0bfc11 56 */
Kojto 109:9296ab0bfc11 57
Kojto 109:9296ab0bfc11 58 /* Exported types ------------------------------------------------------------*/
Kojto 109:9296ab0bfc11 59
Kojto 109:9296ab0bfc11 60 /** @defgroup TSC_Exported_Types TSC Exported Types
Kojto 109:9296ab0bfc11 61 * @{
Kojto 109:9296ab0bfc11 62 */
Kojto 109:9296ab0bfc11 63 /**
Kojto 109:9296ab0bfc11 64 * @brief TSC state structure definition
Kojto 109:9296ab0bfc11 65 */
Kojto 109:9296ab0bfc11 66 typedef enum
Kojto 109:9296ab0bfc11 67 {
Kojto 109:9296ab0bfc11 68 HAL_TSC_STATE_RESET = 0x00, /*!< TSC registers have their reset value */
Kojto 109:9296ab0bfc11 69 HAL_TSC_STATE_READY = 0x01, /*!< TSC registers are initialized or acquisition is completed with success */
Kojto 109:9296ab0bfc11 70 HAL_TSC_STATE_BUSY = 0x02, /*!< TSC initialization or acquisition is on-going */
Kojto 109:9296ab0bfc11 71 HAL_TSC_STATE_ERROR = 0x03 /*!< Acquisition is completed with max count error */
Kojto 109:9296ab0bfc11 72 } HAL_TSC_StateTypeDef;
Kojto 109:9296ab0bfc11 73
Kojto 109:9296ab0bfc11 74 /**
Kojto 109:9296ab0bfc11 75 * @brief TSC group status structure definition
Kojto 109:9296ab0bfc11 76 */
Kojto 109:9296ab0bfc11 77 typedef enum
Kojto 109:9296ab0bfc11 78 {
Kojto 109:9296ab0bfc11 79 TSC_GROUP_ONGOING = 0x00, /*!< Acquisition on group is on-going or not started */
Kojto 109:9296ab0bfc11 80 TSC_GROUP_COMPLETED = 0x01 /*!< Acquisition on group is completed with success (no max count error) */
Kojto 109:9296ab0bfc11 81 } TSC_GroupStatusTypeDef;
Kojto 109:9296ab0bfc11 82
Kojto 109:9296ab0bfc11 83 /**
Kojto 109:9296ab0bfc11 84 * @brief TSC init structure definition
Kojto 109:9296ab0bfc11 85 */
Kojto 109:9296ab0bfc11 86 typedef struct
Kojto 109:9296ab0bfc11 87 {
Kojto 109:9296ab0bfc11 88 uint32_t CTPulseHighLength; /*!< Charge-transfer high pulse length */
Kojto 109:9296ab0bfc11 89 uint32_t CTPulseLowLength; /*!< Charge-transfer low pulse length */
Kojto 109:9296ab0bfc11 90 uint32_t SpreadSpectrum; /*!< Spread spectrum activation */
Kojto 109:9296ab0bfc11 91 uint32_t SpreadSpectrumDeviation; /*!< Spread spectrum deviation */
Kojto 109:9296ab0bfc11 92 uint32_t SpreadSpectrumPrescaler; /*!< Spread spectrum prescaler */
Kojto 109:9296ab0bfc11 93 uint32_t PulseGeneratorPrescaler; /*!< Pulse generator prescaler */
Kojto 109:9296ab0bfc11 94 uint32_t MaxCountValue; /*!< Max count value */
Kojto 109:9296ab0bfc11 95 uint32_t IODefaultMode; /*!< IO default mode */
Kojto 109:9296ab0bfc11 96 uint32_t SynchroPinPolarity; /*!< Synchro pin polarity */
Kojto 109:9296ab0bfc11 97 uint32_t AcquisitionMode; /*!< Acquisition mode */
Kojto 109:9296ab0bfc11 98 uint32_t MaxCountInterrupt; /*!< Max count interrupt activation */
Kojto 109:9296ab0bfc11 99 uint32_t ChannelIOs; /*!< Channel IOs mask */
Kojto 109:9296ab0bfc11 100 uint32_t ShieldIOs; /*!< Shield IOs mask */
Kojto 109:9296ab0bfc11 101 uint32_t SamplingIOs; /*!< Sampling IOs mask */
Kojto 109:9296ab0bfc11 102 } TSC_InitTypeDef;
Kojto 109:9296ab0bfc11 103
Kojto 109:9296ab0bfc11 104 /**
Kojto 109:9296ab0bfc11 105 * @brief TSC IOs configuration structure definition
Kojto 109:9296ab0bfc11 106 */
Kojto 109:9296ab0bfc11 107 typedef struct
Kojto 109:9296ab0bfc11 108 {
Kojto 109:9296ab0bfc11 109 uint32_t ChannelIOs; /*!< Channel IOs mask */
Kojto 109:9296ab0bfc11 110 uint32_t ShieldIOs; /*!< Shield IOs mask */
Kojto 109:9296ab0bfc11 111 uint32_t SamplingIOs; /*!< Sampling IOs mask */
Kojto 109:9296ab0bfc11 112 } TSC_IOConfigTypeDef;
Kojto 109:9296ab0bfc11 113
Kojto 109:9296ab0bfc11 114 /**
Kojto 109:9296ab0bfc11 115 * @brief TSC handle Structure definition
Kojto 109:9296ab0bfc11 116 */
Kojto 109:9296ab0bfc11 117 typedef struct
Kojto 109:9296ab0bfc11 118 {
Kojto 109:9296ab0bfc11 119 TSC_TypeDef *Instance; /*!< Register base address */
Kojto 109:9296ab0bfc11 120 TSC_InitTypeDef Init; /*!< Initialization parameters */
Kojto 109:9296ab0bfc11 121 __IO HAL_TSC_StateTypeDef State; /*!< Peripheral state */
Kojto 109:9296ab0bfc11 122 HAL_LockTypeDef Lock; /*!< Lock feature */
Kojto 109:9296ab0bfc11 123 } TSC_HandleTypeDef;
Kojto 109:9296ab0bfc11 124
Kojto 109:9296ab0bfc11 125 /**
Kojto 109:9296ab0bfc11 126 * @}
Kojto 109:9296ab0bfc11 127 */
Kojto 109:9296ab0bfc11 128
Kojto 109:9296ab0bfc11 129 /* Exported constants --------------------------------------------------------*/
Kojto 109:9296ab0bfc11 130
Kojto 109:9296ab0bfc11 131 /** @defgroup TSC_Exported_Constants TSC Exported Constants
Kojto 109:9296ab0bfc11 132 * @{
Kojto 109:9296ab0bfc11 133 */
Kojto 109:9296ab0bfc11 134
Kojto 109:9296ab0bfc11 135 #define TSC_CTPH_1CYCLE ((uint32_t)((uint32_t) 0 << 28))
Kojto 109:9296ab0bfc11 136 #define TSC_CTPH_2CYCLES ((uint32_t)((uint32_t) 1 << 28))
Kojto 109:9296ab0bfc11 137 #define TSC_CTPH_3CYCLES ((uint32_t)((uint32_t) 2 << 28))
Kojto 109:9296ab0bfc11 138 #define TSC_CTPH_4CYCLES ((uint32_t)((uint32_t) 3 << 28))
Kojto 109:9296ab0bfc11 139 #define TSC_CTPH_5CYCLES ((uint32_t)((uint32_t) 4 << 28))
Kojto 109:9296ab0bfc11 140 #define TSC_CTPH_6CYCLES ((uint32_t)((uint32_t) 5 << 28))
Kojto 109:9296ab0bfc11 141 #define TSC_CTPH_7CYCLES ((uint32_t)((uint32_t) 6 << 28))
Kojto 109:9296ab0bfc11 142 #define TSC_CTPH_8CYCLES ((uint32_t)((uint32_t) 7 << 28))
Kojto 109:9296ab0bfc11 143 #define TSC_CTPH_9CYCLES ((uint32_t)((uint32_t) 8 << 28))
Kojto 109:9296ab0bfc11 144 #define TSC_CTPH_10CYCLES ((uint32_t)((uint32_t) 9 << 28))
Kojto 109:9296ab0bfc11 145 #define TSC_CTPH_11CYCLES ((uint32_t)((uint32_t)10 << 28))
Kojto 109:9296ab0bfc11 146 #define TSC_CTPH_12CYCLES ((uint32_t)((uint32_t)11 << 28))
Kojto 109:9296ab0bfc11 147 #define TSC_CTPH_13CYCLES ((uint32_t)((uint32_t)12 << 28))
Kojto 109:9296ab0bfc11 148 #define TSC_CTPH_14CYCLES ((uint32_t)((uint32_t)13 << 28))
Kojto 109:9296ab0bfc11 149 #define TSC_CTPH_15CYCLES ((uint32_t)((uint32_t)14 << 28))
Kojto 109:9296ab0bfc11 150 #define TSC_CTPH_16CYCLES ((uint32_t)((uint32_t)15 << 28))
Kojto 109:9296ab0bfc11 151 #define IS_TSC_CTPH(VAL) (((VAL) == TSC_CTPH_1CYCLE) || \
Kojto 109:9296ab0bfc11 152 ((VAL) == TSC_CTPH_2CYCLES) || \
Kojto 109:9296ab0bfc11 153 ((VAL) == TSC_CTPH_3CYCLES) || \
Kojto 109:9296ab0bfc11 154 ((VAL) == TSC_CTPH_4CYCLES) || \
Kojto 109:9296ab0bfc11 155 ((VAL) == TSC_CTPH_5CYCLES) || \
Kojto 109:9296ab0bfc11 156 ((VAL) == TSC_CTPH_6CYCLES) || \
Kojto 109:9296ab0bfc11 157 ((VAL) == TSC_CTPH_7CYCLES) || \
Kojto 109:9296ab0bfc11 158 ((VAL) == TSC_CTPH_8CYCLES) || \
Kojto 109:9296ab0bfc11 159 ((VAL) == TSC_CTPH_9CYCLES) || \
Kojto 109:9296ab0bfc11 160 ((VAL) == TSC_CTPH_10CYCLES) || \
Kojto 109:9296ab0bfc11 161 ((VAL) == TSC_CTPH_11CYCLES) || \
Kojto 109:9296ab0bfc11 162 ((VAL) == TSC_CTPH_12CYCLES) || \
Kojto 109:9296ab0bfc11 163 ((VAL) == TSC_CTPH_13CYCLES) || \
Kojto 109:9296ab0bfc11 164 ((VAL) == TSC_CTPH_14CYCLES) || \
Kojto 109:9296ab0bfc11 165 ((VAL) == TSC_CTPH_15CYCLES) || \
Kojto 109:9296ab0bfc11 166 ((VAL) == TSC_CTPH_16CYCLES))
Kojto 109:9296ab0bfc11 167
Kojto 109:9296ab0bfc11 168 #define TSC_CTPL_1CYCLE ((uint32_t)((uint32_t) 0 << 24))
Kojto 109:9296ab0bfc11 169 #define TSC_CTPL_2CYCLES ((uint32_t)((uint32_t) 1 << 24))
Kojto 109:9296ab0bfc11 170 #define TSC_CTPL_3CYCLES ((uint32_t)((uint32_t) 2 << 24))
Kojto 109:9296ab0bfc11 171 #define TSC_CTPL_4CYCLES ((uint32_t)((uint32_t) 3 << 24))
Kojto 109:9296ab0bfc11 172 #define TSC_CTPL_5CYCLES ((uint32_t)((uint32_t) 4 << 24))
Kojto 109:9296ab0bfc11 173 #define TSC_CTPL_6CYCLES ((uint32_t)((uint32_t) 5 << 24))
Kojto 109:9296ab0bfc11 174 #define TSC_CTPL_7CYCLES ((uint32_t)((uint32_t) 6 << 24))
Kojto 109:9296ab0bfc11 175 #define TSC_CTPL_8CYCLES ((uint32_t)((uint32_t) 7 << 24))
Kojto 109:9296ab0bfc11 176 #define TSC_CTPL_9CYCLES ((uint32_t)((uint32_t) 8 << 24))
Kojto 109:9296ab0bfc11 177 #define TSC_CTPL_10CYCLES ((uint32_t)((uint32_t) 9 << 24))
Kojto 109:9296ab0bfc11 178 #define TSC_CTPL_11CYCLES ((uint32_t)((uint32_t)10 << 24))
Kojto 109:9296ab0bfc11 179 #define TSC_CTPL_12CYCLES ((uint32_t)((uint32_t)11 << 24))
Kojto 109:9296ab0bfc11 180 #define TSC_CTPL_13CYCLES ((uint32_t)((uint32_t)12 << 24))
Kojto 109:9296ab0bfc11 181 #define TSC_CTPL_14CYCLES ((uint32_t)((uint32_t)13 << 24))
Kojto 109:9296ab0bfc11 182 #define TSC_CTPL_15CYCLES ((uint32_t)((uint32_t)14 << 24))
Kojto 109:9296ab0bfc11 183 #define TSC_CTPL_16CYCLES ((uint32_t)((uint32_t)15 << 24))
Kojto 109:9296ab0bfc11 184 #define IS_TSC_CTPL(VAL) (((VAL) == TSC_CTPL_1CYCLE) || \
Kojto 109:9296ab0bfc11 185 ((VAL) == TSC_CTPL_2CYCLES) || \
Kojto 109:9296ab0bfc11 186 ((VAL) == TSC_CTPL_3CYCLES) || \
Kojto 109:9296ab0bfc11 187 ((VAL) == TSC_CTPL_4CYCLES) || \
Kojto 109:9296ab0bfc11 188 ((VAL) == TSC_CTPL_5CYCLES) || \
Kojto 109:9296ab0bfc11 189 ((VAL) == TSC_CTPL_6CYCLES) || \
Kojto 109:9296ab0bfc11 190 ((VAL) == TSC_CTPL_7CYCLES) || \
Kojto 109:9296ab0bfc11 191 ((VAL) == TSC_CTPL_8CYCLES) || \
Kojto 109:9296ab0bfc11 192 ((VAL) == TSC_CTPL_9CYCLES) || \
Kojto 109:9296ab0bfc11 193 ((VAL) == TSC_CTPL_10CYCLES) || \
Kojto 109:9296ab0bfc11 194 ((VAL) == TSC_CTPL_11CYCLES) || \
Kojto 109:9296ab0bfc11 195 ((VAL) == TSC_CTPL_12CYCLES) || \
Kojto 109:9296ab0bfc11 196 ((VAL) == TSC_CTPL_13CYCLES) || \
Kojto 109:9296ab0bfc11 197 ((VAL) == TSC_CTPL_14CYCLES) || \
Kojto 109:9296ab0bfc11 198 ((VAL) == TSC_CTPL_15CYCLES) || \
Kojto 109:9296ab0bfc11 199 ((VAL) == TSC_CTPL_16CYCLES))
Kojto 109:9296ab0bfc11 200
Kojto 109:9296ab0bfc11 201 #define IS_TSC_SS(VAL) (((VAL) == DISABLE) || ((VAL) == ENABLE))
Kojto 109:9296ab0bfc11 202
Kojto 109:9296ab0bfc11 203 #define IS_TSC_SSD(VAL) (((VAL) == 0) || (((VAL) > 0) && ((VAL) < 128)))
Kojto 109:9296ab0bfc11 204
Kojto 109:9296ab0bfc11 205 #define TSC_SS_PRESC_DIV1 ((uint32_t)0)
Kojto 109:9296ab0bfc11 206 #define TSC_SS_PRESC_DIV2 (TSC_CR_SSPSC)
Kojto 109:9296ab0bfc11 207 #define IS_TSC_SS_PRESC(VAL) (((VAL) == TSC_SS_PRESC_DIV1) || ((VAL) == TSC_SS_PRESC_DIV2))
Kojto 109:9296ab0bfc11 208
Kojto 109:9296ab0bfc11 209 #define TSC_PG_PRESC_DIV1 ((uint32_t)(0 << 12))
Kojto 109:9296ab0bfc11 210 #define TSC_PG_PRESC_DIV2 ((uint32_t)(1 << 12))
Kojto 109:9296ab0bfc11 211 #define TSC_PG_PRESC_DIV4 ((uint32_t)(2 << 12))
Kojto 109:9296ab0bfc11 212 #define TSC_PG_PRESC_DIV8 ((uint32_t)(3 << 12))
Kojto 109:9296ab0bfc11 213 #define TSC_PG_PRESC_DIV16 ((uint32_t)(4 << 12))
Kojto 109:9296ab0bfc11 214 #define TSC_PG_PRESC_DIV32 ((uint32_t)(5 << 12))
Kojto 109:9296ab0bfc11 215 #define TSC_PG_PRESC_DIV64 ((uint32_t)(6 << 12))
Kojto 109:9296ab0bfc11 216 #define TSC_PG_PRESC_DIV128 ((uint32_t)(7 << 12))
Kojto 109:9296ab0bfc11 217 #define IS_TSC_PG_PRESC(VAL) (((VAL) == TSC_PG_PRESC_DIV1) || \
Kojto 109:9296ab0bfc11 218 ((VAL) == TSC_PG_PRESC_DIV2) || \
Kojto 109:9296ab0bfc11 219 ((VAL) == TSC_PG_PRESC_DIV4) || \
Kojto 109:9296ab0bfc11 220 ((VAL) == TSC_PG_PRESC_DIV8) || \
Kojto 109:9296ab0bfc11 221 ((VAL) == TSC_PG_PRESC_DIV16) || \
Kojto 109:9296ab0bfc11 222 ((VAL) == TSC_PG_PRESC_DIV32) || \
Kojto 109:9296ab0bfc11 223 ((VAL) == TSC_PG_PRESC_DIV64) || \
Kojto 109:9296ab0bfc11 224 ((VAL) == TSC_PG_PRESC_DIV128))
Kojto 109:9296ab0bfc11 225
Kojto 109:9296ab0bfc11 226 #define TSC_MCV_255 ((uint32_t)(0 << 5))
Kojto 109:9296ab0bfc11 227 #define TSC_MCV_511 ((uint32_t)(1 << 5))
Kojto 109:9296ab0bfc11 228 #define TSC_MCV_1023 ((uint32_t)(2 << 5))
Kojto 109:9296ab0bfc11 229 #define TSC_MCV_2047 ((uint32_t)(3 << 5))
Kojto 109:9296ab0bfc11 230 #define TSC_MCV_4095 ((uint32_t)(4 << 5))
Kojto 109:9296ab0bfc11 231 #define TSC_MCV_8191 ((uint32_t)(5 << 5))
Kojto 109:9296ab0bfc11 232 #define TSC_MCV_16383 ((uint32_t)(6 << 5))
Kojto 109:9296ab0bfc11 233 #define IS_TSC_MCV(VAL) (((VAL) == TSC_MCV_255) || \
Kojto 109:9296ab0bfc11 234 ((VAL) == TSC_MCV_511) || \
Kojto 109:9296ab0bfc11 235 ((VAL) == TSC_MCV_1023) || \
Kojto 109:9296ab0bfc11 236 ((VAL) == TSC_MCV_2047) || \
Kojto 109:9296ab0bfc11 237 ((VAL) == TSC_MCV_4095) || \
Kojto 109:9296ab0bfc11 238 ((VAL) == TSC_MCV_8191) || \
Kojto 109:9296ab0bfc11 239 ((VAL) == TSC_MCV_16383))
Kojto 109:9296ab0bfc11 240
Kojto 109:9296ab0bfc11 241 #define TSC_IODEF_OUT_PP_LOW ((uint32_t)0)
Kojto 109:9296ab0bfc11 242 #define TSC_IODEF_IN_FLOAT (TSC_CR_IODEF)
Kojto 109:9296ab0bfc11 243 #define IS_TSC_IODEF(VAL) (((VAL) == TSC_IODEF_OUT_PP_LOW) || ((VAL) == TSC_IODEF_IN_FLOAT))
Kojto 109:9296ab0bfc11 244
Kojto 109:9296ab0bfc11 245 #define TSC_SYNC_POL_FALL ((uint32_t)0)
Kojto 109:9296ab0bfc11 246 #define TSC_SYNC_POL_RISE_HIGH (TSC_CR_SYNCPOL)
Kojto 109:9296ab0bfc11 247 #define IS_TSC_SYNC_POL(VAL) (((VAL) == TSC_SYNC_POL_FALL) || ((VAL) == TSC_SYNC_POL_RISE_HIGH))
Kojto 109:9296ab0bfc11 248
Kojto 109:9296ab0bfc11 249 #define TSC_ACQ_MODE_NORMAL ((uint32_t)0)
Kojto 109:9296ab0bfc11 250 #define TSC_ACQ_MODE_SYNCHRO (TSC_CR_AM)
Kojto 109:9296ab0bfc11 251 #define IS_TSC_ACQ_MODE(VAL) (((VAL) == TSC_ACQ_MODE_NORMAL) || ((VAL) == TSC_ACQ_MODE_SYNCHRO))
Kojto 109:9296ab0bfc11 252
Kojto 109:9296ab0bfc11 253 #define TSC_IOMODE_UNUSED ((uint32_t)0)
Kojto 109:9296ab0bfc11 254 #define TSC_IOMODE_CHANNEL ((uint32_t)1)
Kojto 109:9296ab0bfc11 255 #define TSC_IOMODE_SHIELD ((uint32_t)2)
Kojto 109:9296ab0bfc11 256 #define TSC_IOMODE_SAMPLING ((uint32_t)3)
Kojto 109:9296ab0bfc11 257 #define IS_TSC_IOMODE(VAL) (((VAL) == TSC_IOMODE_UNUSED) || \
Kojto 109:9296ab0bfc11 258 ((VAL) == TSC_IOMODE_CHANNEL) || \
Kojto 109:9296ab0bfc11 259 ((VAL) == TSC_IOMODE_SHIELD) || \
Kojto 109:9296ab0bfc11 260 ((VAL) == TSC_IOMODE_SAMPLING))
Kojto 109:9296ab0bfc11 261
Kojto 109:9296ab0bfc11 262 /** @defgroup TSC_interrupts_definition TSC interrupts definition
Kojto 109:9296ab0bfc11 263 * @{
Kojto 109:9296ab0bfc11 264 */
Kojto 109:9296ab0bfc11 265 #define TSC_IT_EOA ((uint32_t)TSC_IER_EOAIE)
Kojto 109:9296ab0bfc11 266 #define TSC_IT_MCE ((uint32_t)TSC_IER_MCEIE)
Kojto 109:9296ab0bfc11 267 #define IS_TSC_MCE_IT(VAL) (((VAL) == DISABLE) || ((VAL) == ENABLE))
Kojto 109:9296ab0bfc11 268 /**
Kojto 109:9296ab0bfc11 269 * @}
Kojto 109:9296ab0bfc11 270 */
Kojto 109:9296ab0bfc11 271
Kojto 109:9296ab0bfc11 272 /** @defgroup TSC_flags_definition TSC Flags Definition
Kojto 109:9296ab0bfc11 273 * @{
Kojto 109:9296ab0bfc11 274 */
Kojto 109:9296ab0bfc11 275 #define TSC_FLAG_EOA ((uint32_t)TSC_ISR_EOAF)
Kojto 109:9296ab0bfc11 276 #define TSC_FLAG_MCE ((uint32_t)TSC_ISR_MCEF)
Kojto 109:9296ab0bfc11 277 /**
Kojto 109:9296ab0bfc11 278 * @}
Kojto 109:9296ab0bfc11 279 */
Kojto 109:9296ab0bfc11 280
Kojto 109:9296ab0bfc11 281 #define TSC_NB_OF_GROUPS (8)
Kojto 109:9296ab0bfc11 282
Kojto 109:9296ab0bfc11 283 #define TSC_GROUP1 ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 284 #define TSC_GROUP2 ((uint32_t)0x00000002)
Kojto 109:9296ab0bfc11 285 #define TSC_GROUP3 ((uint32_t)0x00000004)
Kojto 109:9296ab0bfc11 286 #define TSC_GROUP4 ((uint32_t)0x00000008)
Kojto 109:9296ab0bfc11 287 #define TSC_GROUP5 ((uint32_t)0x00000010)
Kojto 109:9296ab0bfc11 288 #define TSC_GROUP6 ((uint32_t)0x00000020)
Kojto 109:9296ab0bfc11 289 #define TSC_GROUP7 ((uint32_t)0x00000040)
Kojto 109:9296ab0bfc11 290 #define TSC_GROUP8 ((uint32_t)0x00000080)
Kojto 109:9296ab0bfc11 291 #define TSC_ALL_GROUPS ((uint32_t)0x000000FF)
Kojto 109:9296ab0bfc11 292
Kojto 109:9296ab0bfc11 293 #define TSC_GROUP1_IDX ((uint32_t)0)
Kojto 109:9296ab0bfc11 294 #define TSC_GROUP2_IDX ((uint32_t)1)
Kojto 109:9296ab0bfc11 295 #define TSC_GROUP3_IDX ((uint32_t)2)
Kojto 109:9296ab0bfc11 296 #define TSC_GROUP4_IDX ((uint32_t)3)
Kojto 109:9296ab0bfc11 297 #define TSC_GROUP5_IDX ((uint32_t)4)
Kojto 109:9296ab0bfc11 298 #define TSC_GROUP6_IDX ((uint32_t)5)
Kojto 109:9296ab0bfc11 299 #define TSC_GROUP7_IDX ((uint32_t)6)
Kojto 109:9296ab0bfc11 300 #define TSC_GROUP8_IDX ((uint32_t)7)
Kojto 109:9296ab0bfc11 301 #define IS_GROUP_INDEX(VAL) (((VAL) == 0) || (((VAL) > 0) && ((VAL) < TSC_NB_OF_GROUPS)))
Kojto 109:9296ab0bfc11 302
Kojto 109:9296ab0bfc11 303 #define TSC_GROUP1_IO1 ((uint32_t)0x00000001)
Kojto 109:9296ab0bfc11 304 #define TSC_GROUP1_IO2 ((uint32_t)0x00000002)
Kojto 109:9296ab0bfc11 305 #define TSC_GROUP1_IO3 ((uint32_t)0x00000004)
Kojto 109:9296ab0bfc11 306 #define TSC_GROUP1_IO4 ((uint32_t)0x00000008)
Kojto 109:9296ab0bfc11 307 #define TSC_GROUP1_ALL_IOS ((uint32_t)0x0000000F)
Kojto 109:9296ab0bfc11 308
Kojto 109:9296ab0bfc11 309 #define TSC_GROUP2_IO1 ((uint32_t)0x00000010)
Kojto 109:9296ab0bfc11 310 #define TSC_GROUP2_IO2 ((uint32_t)0x00000020)
Kojto 109:9296ab0bfc11 311 #define TSC_GROUP2_IO3 ((uint32_t)0x00000040)
Kojto 109:9296ab0bfc11 312 #define TSC_GROUP2_IO4 ((uint32_t)0x00000080)
Kojto 109:9296ab0bfc11 313 #define TSC_GROUP2_ALL_IOS ((uint32_t)0x000000F0)
Kojto 109:9296ab0bfc11 314
Kojto 109:9296ab0bfc11 315 #define TSC_GROUP3_IO1 ((uint32_t)0x00000100)
Kojto 109:9296ab0bfc11 316 #define TSC_GROUP3_IO2 ((uint32_t)0x00000200)
Kojto 109:9296ab0bfc11 317 #define TSC_GROUP3_IO3 ((uint32_t)0x00000400)
Kojto 109:9296ab0bfc11 318 #define TSC_GROUP3_IO4 ((uint32_t)0x00000800)
Kojto 109:9296ab0bfc11 319 #define TSC_GROUP3_ALL_IOS ((uint32_t)0x00000F00)
Kojto 109:9296ab0bfc11 320
Kojto 109:9296ab0bfc11 321 #define TSC_GROUP4_IO1 ((uint32_t)0x00001000)
Kojto 109:9296ab0bfc11 322 #define TSC_GROUP4_IO2 ((uint32_t)0x00002000)
Kojto 109:9296ab0bfc11 323 #define TSC_GROUP4_IO3 ((uint32_t)0x00004000)
Kojto 109:9296ab0bfc11 324 #define TSC_GROUP4_IO4 ((uint32_t)0x00008000)
Kojto 109:9296ab0bfc11 325 #define TSC_GROUP4_ALL_IOS ((uint32_t)0x0000F000)
Kojto 109:9296ab0bfc11 326
Kojto 109:9296ab0bfc11 327 #define TSC_GROUP5_IO1 ((uint32_t)0x00010000)
Kojto 109:9296ab0bfc11 328 #define TSC_GROUP5_IO2 ((uint32_t)0x00020000)
Kojto 109:9296ab0bfc11 329 #define TSC_GROUP5_IO3 ((uint32_t)0x00040000)
Kojto 109:9296ab0bfc11 330 #define TSC_GROUP5_IO4 ((uint32_t)0x00080000)
Kojto 109:9296ab0bfc11 331 #define TSC_GROUP5_ALL_IOS ((uint32_t)0x000F0000)
Kojto 109:9296ab0bfc11 332
Kojto 109:9296ab0bfc11 333 #define TSC_GROUP6_IO1 ((uint32_t)0x00100000)
Kojto 109:9296ab0bfc11 334 #define TSC_GROUP6_IO2 ((uint32_t)0x00200000)
Kojto 109:9296ab0bfc11 335 #define TSC_GROUP6_IO3 ((uint32_t)0x00400000)
Kojto 109:9296ab0bfc11 336 #define TSC_GROUP6_IO4 ((uint32_t)0x00800000)
Kojto 109:9296ab0bfc11 337 #define TSC_GROUP6_ALL_IOS ((uint32_t)0x00F00000)
Kojto 109:9296ab0bfc11 338
Kojto 109:9296ab0bfc11 339 #define TSC_GROUP7_IO1 ((uint32_t)0x01000000)
Kojto 109:9296ab0bfc11 340 #define TSC_GROUP7_IO2 ((uint32_t)0x02000000)
Kojto 109:9296ab0bfc11 341 #define TSC_GROUP7_IO3 ((uint32_t)0x04000000)
Kojto 109:9296ab0bfc11 342 #define TSC_GROUP7_IO4 ((uint32_t)0x08000000)
Kojto 109:9296ab0bfc11 343 #define TSC_GROUP7_ALL_IOS ((uint32_t)0x0F000000)
Kojto 109:9296ab0bfc11 344
Kojto 109:9296ab0bfc11 345 #define TSC_GROUP8_IO1 ((uint32_t)0x10000000)
Kojto 109:9296ab0bfc11 346 #define TSC_GROUP8_IO2 ((uint32_t)0x20000000)
Kojto 109:9296ab0bfc11 347 #define TSC_GROUP8_IO3 ((uint32_t)0x40000000)
Kojto 109:9296ab0bfc11 348 #define TSC_GROUP8_IO4 ((uint32_t)0x80000000)
Kojto 109:9296ab0bfc11 349 #define TSC_GROUP8_ALL_IOS ((uint32_t)0xF0000000)
Kojto 109:9296ab0bfc11 350
Kojto 109:9296ab0bfc11 351 #define TSC_ALL_GROUPS_ALL_IOS ((uint32_t)0xFFFFFFFF)
Kojto 109:9296ab0bfc11 352
Kojto 109:9296ab0bfc11 353 /**
Kojto 109:9296ab0bfc11 354 * @}
Kojto 109:9296ab0bfc11 355 */
Kojto 109:9296ab0bfc11 356
Kojto 109:9296ab0bfc11 357 /* Exported macros -----------------------------------------------------------*/
Kojto 109:9296ab0bfc11 358 /** @defgroup TSC_Exported_Macros TSC Exported Macros
Kojto 109:9296ab0bfc11 359 * @{
Kojto 109:9296ab0bfc11 360 */
Kojto 109:9296ab0bfc11 361
Kojto 109:9296ab0bfc11 362 /** @brief Reset TSC handle state
Kojto 109:9296ab0bfc11 363 * @param __HANDLE__: TSC handle.
Kojto 109:9296ab0bfc11 364 * @retval None
Kojto 109:9296ab0bfc11 365 */
Kojto 109:9296ab0bfc11 366 #define __HAL_TSC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_TSC_STATE_RESET)
Kojto 109:9296ab0bfc11 367
Kojto 109:9296ab0bfc11 368 /**
Kojto 109:9296ab0bfc11 369 * @brief Enable the TSC peripheral.
Kojto 109:9296ab0bfc11 370 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 371 * @retval None
Kojto 109:9296ab0bfc11 372 */
Kojto 109:9296ab0bfc11 373 #define __HAL_TSC_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= TSC_CR_TSCE)
Kojto 109:9296ab0bfc11 374
Kojto 109:9296ab0bfc11 375 /**
Kojto 109:9296ab0bfc11 376 * @brief Disable the TSC peripheral.
Kojto 109:9296ab0bfc11 377 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 378 * @retval None
Kojto 109:9296ab0bfc11 379 */
Kojto 109:9296ab0bfc11 380 #define __HAL_TSC_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= (uint32_t)(~TSC_CR_TSCE))
Kojto 109:9296ab0bfc11 381
Kojto 109:9296ab0bfc11 382 /**
Kojto 109:9296ab0bfc11 383 * @brief Start acquisition
Kojto 109:9296ab0bfc11 384 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 385 * @retval None
Kojto 109:9296ab0bfc11 386 */
Kojto 109:9296ab0bfc11 387 #define __HAL_TSC_START_ACQ(__HANDLE__) ((__HANDLE__)->Instance->CR |= TSC_CR_START)
Kojto 109:9296ab0bfc11 388
Kojto 109:9296ab0bfc11 389 /**
Kojto 109:9296ab0bfc11 390 * @brief Stop acquisition
Kojto 109:9296ab0bfc11 391 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 392 * @retval None
Kojto 109:9296ab0bfc11 393 */
Kojto 109:9296ab0bfc11 394 #define __HAL_TSC_STOP_ACQ(__HANDLE__) ((__HANDLE__)->Instance->CR &= (uint32_t)(~TSC_CR_START))
Kojto 109:9296ab0bfc11 395
Kojto 109:9296ab0bfc11 396 /**
Kojto 109:9296ab0bfc11 397 * @brief Set IO default mode to output push-pull low
Kojto 109:9296ab0bfc11 398 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 399 * @retval None
Kojto 109:9296ab0bfc11 400 */
Kojto 109:9296ab0bfc11 401 #define __HAL_TSC_SET_IODEF_OUTPPLOW(__HANDLE__) ((__HANDLE__)->Instance->CR &= (uint32_t)(~TSC_CR_IODEF))
Kojto 109:9296ab0bfc11 402
Kojto 109:9296ab0bfc11 403 /**
Kojto 109:9296ab0bfc11 404 * @brief Set IO default mode to input floating
Kojto 109:9296ab0bfc11 405 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 406 * @retval None
Kojto 109:9296ab0bfc11 407 */
Kojto 109:9296ab0bfc11 408 #define __HAL_TSC_SET_IODEF_INFLOAT(__HANDLE__) ((__HANDLE__)->Instance->CR |= TSC_CR_IODEF)
Kojto 109:9296ab0bfc11 409
Kojto 109:9296ab0bfc11 410 /**
Kojto 109:9296ab0bfc11 411 * @brief Set synchronization polarity to falling edge
Kojto 109:9296ab0bfc11 412 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 413 * @retval None
Kojto 109:9296ab0bfc11 414 */
Kojto 109:9296ab0bfc11 415 #define __HAL_TSC_SET_SYNC_POL_FALL(__HANDLE__) ((__HANDLE__)->Instance->CR &= (uint32_t)(~TSC_CR_SYNCPOL))
Kojto 109:9296ab0bfc11 416
Kojto 109:9296ab0bfc11 417 /**
Kojto 109:9296ab0bfc11 418 * @brief Set synchronization polarity to rising edge and high level
Kojto 109:9296ab0bfc11 419 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 420 * @retval None
Kojto 109:9296ab0bfc11 421 */
Kojto 109:9296ab0bfc11 422 #define __HAL_TSC_SET_SYNC_POL_RISE_HIGH(__HANDLE__) ((__HANDLE__)->Instance->CR |= TSC_CR_SYNCPOL)
Kojto 109:9296ab0bfc11 423
Kojto 109:9296ab0bfc11 424 /**
Kojto 109:9296ab0bfc11 425 * @brief Enable TSC interrupt.
Kojto 109:9296ab0bfc11 426 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 427 * @param __INTERRUPT__: TSC interrupt
Kojto 109:9296ab0bfc11 428 * @retval None
Kojto 109:9296ab0bfc11 429 */
Kojto 109:9296ab0bfc11 430 #define __HAL_TSC_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
Kojto 109:9296ab0bfc11 431
Kojto 109:9296ab0bfc11 432 /**
Kojto 109:9296ab0bfc11 433 * @brief Disable TSC interrupt.
Kojto 109:9296ab0bfc11 434 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 435 * @param __INTERRUPT__: TSC interrupt
Kojto 109:9296ab0bfc11 436 * @retval None
Kojto 109:9296ab0bfc11 437 */
Kojto 109:9296ab0bfc11 438 #define __HAL_TSC_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (uint32_t)(~(__INTERRUPT__)))
Kojto 109:9296ab0bfc11 439
Kojto 109:9296ab0bfc11 440 /** @brief Check if the specified TSC interrupt source is enabled or disabled.
Kojto 109:9296ab0bfc11 441 * @param __HANDLE__: TSC Handle
Kojto 109:9296ab0bfc11 442 * @param __INTERRUPT__: TSC interrupt
Kojto 109:9296ab0bfc11 443 * @retval SET or RESET
Kojto 109:9296ab0bfc11 444 */
Kojto 109:9296ab0bfc11 445 #define __HAL_TSC_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET)
Kojto 109:9296ab0bfc11 446
Kojto 109:9296ab0bfc11 447 /**
Kojto 109:9296ab0bfc11 448 * @brief Get the selected TSC's flag status.
Kojto 109:9296ab0bfc11 449 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 450 * @param __FLAG__: TSC flag
Kojto 109:9296ab0bfc11 451 * @retval SET or RESET
Kojto 109:9296ab0bfc11 452 */
Kojto 109:9296ab0bfc11 453 #define __HAL_TSC_GET_FLAG(__HANDLE__, __FLAG__) ((((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__)) ? SET : RESET)
Kojto 109:9296ab0bfc11 454
Kojto 109:9296ab0bfc11 455 /**
Kojto 109:9296ab0bfc11 456 * @brief Clear the TSC's pending flag.
Kojto 109:9296ab0bfc11 457 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 458 * @param __FLAG__: TSC flag
Kojto 109:9296ab0bfc11 459 * @retval None
Kojto 109:9296ab0bfc11 460 */
Kojto 109:9296ab0bfc11 461 #define __HAL_TSC_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
Kojto 109:9296ab0bfc11 462
Kojto 109:9296ab0bfc11 463 /**
Kojto 109:9296ab0bfc11 464 * @brief Enable schmitt trigger hysteresis on a group of IOs
Kojto 109:9296ab0bfc11 465 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 466 * @param __GX_IOY_MASK__: IOs mask
Kojto 109:9296ab0bfc11 467 * @retval None
Kojto 109:9296ab0bfc11 468 */
Kojto 109:9296ab0bfc11 469 #define __HAL_TSC_ENABLE_HYSTERESIS(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOHCR |= (__GX_IOY_MASK__))
Kojto 109:9296ab0bfc11 470
Kojto 109:9296ab0bfc11 471 /**
Kojto 109:9296ab0bfc11 472 * @brief Disable schmitt trigger hysteresis on a group of IOs
Kojto 109:9296ab0bfc11 473 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 474 * @param __GX_IOY_MASK__: IOs mask
Kojto 109:9296ab0bfc11 475 * @retval None
Kojto 109:9296ab0bfc11 476 */
Kojto 109:9296ab0bfc11 477 #define __HAL_TSC_DISABLE_HYSTERESIS(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOHCR &= (uint32_t)(~(__GX_IOY_MASK__)))
Kojto 109:9296ab0bfc11 478
Kojto 109:9296ab0bfc11 479 /**
Kojto 109:9296ab0bfc11 480 * @brief Open analog switch on a group of IOs
Kojto 109:9296ab0bfc11 481 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 482 * @param __GX_IOY_MASK__: IOs mask
Kojto 109:9296ab0bfc11 483 * @retval None
Kojto 109:9296ab0bfc11 484 */
Kojto 109:9296ab0bfc11 485 #define __HAL_TSC_OPEN_ANALOG_SWITCH(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOASCR &= (uint32_t)(~(__GX_IOY_MASK__)))
Kojto 109:9296ab0bfc11 486
Kojto 109:9296ab0bfc11 487 /**
Kojto 109:9296ab0bfc11 488 * @brief Close analog switch on a group of IOs
Kojto 109:9296ab0bfc11 489 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 490 * @param __GX_IOY_MASK__: IOs mask
Kojto 109:9296ab0bfc11 491 * @retval None
Kojto 109:9296ab0bfc11 492 */
Kojto 109:9296ab0bfc11 493 #define __HAL_TSC_CLOSE_ANALOG_SWITCH(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOASCR |= (__GX_IOY_MASK__))
Kojto 109:9296ab0bfc11 494
Kojto 109:9296ab0bfc11 495 /**
Kojto 109:9296ab0bfc11 496 * @brief Enable a group of IOs in channel mode
Kojto 109:9296ab0bfc11 497 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 498 * @param __GX_IOY_MASK__: IOs mask
Kojto 109:9296ab0bfc11 499 * @retval None
Kojto 109:9296ab0bfc11 500 */
Kojto 109:9296ab0bfc11 501 #define __HAL_TSC_ENABLE_CHANNEL(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOCCR |= (__GX_IOY_MASK__))
Kojto 109:9296ab0bfc11 502
Kojto 109:9296ab0bfc11 503 /**
Kojto 109:9296ab0bfc11 504 * @brief Disable a group of channel IOs
Kojto 109:9296ab0bfc11 505 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 506 * @param __GX_IOY_MASK__: IOs mask
Kojto 109:9296ab0bfc11 507 * @retval None
Kojto 109:9296ab0bfc11 508 */
Kojto 109:9296ab0bfc11 509 #define __HAL_TSC_DISABLE_CHANNEL(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOCCR &= (uint32_t)(~(__GX_IOY_MASK__)))
Kojto 109:9296ab0bfc11 510
Kojto 109:9296ab0bfc11 511 /**
Kojto 109:9296ab0bfc11 512 * @brief Enable a group of IOs in sampling mode
Kojto 109:9296ab0bfc11 513 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 514 * @param __GX_IOY_MASK__: IOs mask
Kojto 109:9296ab0bfc11 515 * @retval None
Kojto 109:9296ab0bfc11 516 */
Kojto 109:9296ab0bfc11 517 #define __HAL_TSC_ENABLE_SAMPLING(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOSCR |= (__GX_IOY_MASK__))
Kojto 109:9296ab0bfc11 518
Kojto 109:9296ab0bfc11 519 /**
Kojto 109:9296ab0bfc11 520 * @brief Disable a group of sampling IOs
Kojto 109:9296ab0bfc11 521 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 522 * @param __GX_IOY_MASK__: IOs mask
Kojto 109:9296ab0bfc11 523 * @retval None
Kojto 109:9296ab0bfc11 524 */
Kojto 109:9296ab0bfc11 525 #define __HAL_TSC_DISABLE_SAMPLING(__HANDLE__, __GX_IOY_MASK__) ((__HANDLE__)->Instance->IOSCR &= (uint32_t)(~(__GX_IOY_MASK__)))
Kojto 109:9296ab0bfc11 526
Kojto 109:9296ab0bfc11 527 /**
Kojto 109:9296ab0bfc11 528 * @brief Enable acquisition groups
Kojto 109:9296ab0bfc11 529 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 530 * @param __GX_MASK__: Groups mask
Kojto 109:9296ab0bfc11 531 * @retval None
Kojto 109:9296ab0bfc11 532 */
Kojto 109:9296ab0bfc11 533 #define __HAL_TSC_ENABLE_GROUP(__HANDLE__, __GX_MASK__) ((__HANDLE__)->Instance->IOGCSR |= (__GX_MASK__))
Kojto 109:9296ab0bfc11 534
Kojto 109:9296ab0bfc11 535 /**
Kojto 109:9296ab0bfc11 536 * @brief Disable acquisition groups
Kojto 109:9296ab0bfc11 537 * @param __HANDLE__: TSC handle
Kojto 109:9296ab0bfc11 538 * @param __GX_MASK__: Groups mask
Kojto 109:9296ab0bfc11 539 * @retval None
Kojto 109:9296ab0bfc11 540 */
Kojto 109:9296ab0bfc11 541 #define __HAL_TSC_DISABLE_GROUP(__HANDLE__, __GX_MASK__) ((__HANDLE__)->Instance->IOGCSR &= (uint32_t)(~(__GX_MASK__)))
Kojto 109:9296ab0bfc11 542
Kojto 109:9296ab0bfc11 543 /** @brief Gets acquisition group status
Kojto 109:9296ab0bfc11 544 * @param __HANDLE__: TSC Handle
Kojto 109:9296ab0bfc11 545 * @param __GX_INDEX__: Group index
Kojto 109:9296ab0bfc11 546 * @retval SET or RESET
Kojto 109:9296ab0bfc11 547 */
Kojto 109:9296ab0bfc11 548 #define __HAL_TSC_GET_GROUP_STATUS(__HANDLE__, __GX_INDEX__) \
Kojto 109:9296ab0bfc11 549 ((((__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 550
Kojto 109:9296ab0bfc11 551 /**
Kojto 109:9296ab0bfc11 552 * @}
Kojto 109:9296ab0bfc11 553 */
Kojto 109:9296ab0bfc11 554
Kojto 109:9296ab0bfc11 555 /* Exported functions --------------------------------------------------------*/
Kojto 109:9296ab0bfc11 556 /** @addtogroup TSC_Exported_Functions TSC Exported Functions
Kojto 109:9296ab0bfc11 557 * @{
Kojto 109:9296ab0bfc11 558 */
Kojto 109:9296ab0bfc11 559
Kojto 109:9296ab0bfc11 560 /** @addtogroup TSC_Exported_Functions_Group1 Initialization and de-initialization functions
Kojto 109:9296ab0bfc11 561 * @brief Initialization and Configuration functions
Kojto 109:9296ab0bfc11 562 * @{
Kojto 109:9296ab0bfc11 563 */
Kojto 109:9296ab0bfc11 564 /* Initialization and de-initialization functions *****************************/
Kojto 109:9296ab0bfc11 565 HAL_StatusTypeDef HAL_TSC_Init(TSC_HandleTypeDef* htsc);
Kojto 109:9296ab0bfc11 566 HAL_StatusTypeDef HAL_TSC_DeInit(TSC_HandleTypeDef *htsc);
Kojto 109:9296ab0bfc11 567 void HAL_TSC_MspInit(TSC_HandleTypeDef* htsc);
Kojto 109:9296ab0bfc11 568 void HAL_TSC_MspDeInit(TSC_HandleTypeDef* htsc);
Kojto 109:9296ab0bfc11 569 /**
Kojto 109:9296ab0bfc11 570 * @}
Kojto 109:9296ab0bfc11 571 */
Kojto 109:9296ab0bfc11 572
Kojto 109:9296ab0bfc11 573 /** @addtogroup TSC_Exported_Functions_Group2 Input and Output operation functions
Kojto 109:9296ab0bfc11 574 * @brief IO operation functions
Kojto 109:9296ab0bfc11 575 * @{
Kojto 109:9296ab0bfc11 576 */
Kojto 109:9296ab0bfc11 577 /* IO operation functions *****************************************************/
Kojto 109:9296ab0bfc11 578 HAL_StatusTypeDef HAL_TSC_Start(TSC_HandleTypeDef* htsc);
Kojto 109:9296ab0bfc11 579 HAL_StatusTypeDef HAL_TSC_Start_IT(TSC_HandleTypeDef* htsc);
Kojto 109:9296ab0bfc11 580 HAL_StatusTypeDef HAL_TSC_Stop(TSC_HandleTypeDef* htsc);
Kojto 109:9296ab0bfc11 581 HAL_StatusTypeDef HAL_TSC_Stop_IT(TSC_HandleTypeDef* htsc);
Kojto 109:9296ab0bfc11 582 TSC_GroupStatusTypeDef HAL_TSC_GroupGetStatus(TSC_HandleTypeDef* htsc, uint32_t gx_index);
Kojto 109:9296ab0bfc11 583 uint32_t HAL_TSC_GroupGetValue(TSC_HandleTypeDef* htsc, uint32_t gx_index);
Kojto 109:9296ab0bfc11 584 /**
Kojto 109:9296ab0bfc11 585 * @}
Kojto 109:9296ab0bfc11 586 */
Kojto 109:9296ab0bfc11 587
Kojto 109:9296ab0bfc11 588 /** @addtogroup TSC_Exported_Functions_Group3 Peripheral Control functions
Kojto 109:9296ab0bfc11 589 * @brief Peripheral Control functions
Kojto 109:9296ab0bfc11 590 * @{
Kojto 109:9296ab0bfc11 591 */
Kojto 109:9296ab0bfc11 592 /* Peripheral Control functions ***********************************************/
Kojto 109:9296ab0bfc11 593 HAL_StatusTypeDef HAL_TSC_IOConfig(TSC_HandleTypeDef* htsc, TSC_IOConfigTypeDef* config);
Kojto 109:9296ab0bfc11 594 HAL_StatusTypeDef HAL_TSC_IODischarge(TSC_HandleTypeDef* htsc, uint32_t choice);
Kojto 109:9296ab0bfc11 595 /**
Kojto 109:9296ab0bfc11 596 * @}
Kojto 109:9296ab0bfc11 597 */
Kojto 109:9296ab0bfc11 598
Kojto 109:9296ab0bfc11 599 /** @addtogroup TSC_Exported_Functions_Group4 Peripheral State functions
Kojto 109:9296ab0bfc11 600 * @brief State functions
Kojto 109:9296ab0bfc11 601 * @{
Kojto 109:9296ab0bfc11 602 */
Kojto 109:9296ab0bfc11 603 /* Peripheral State and Error functions ***************************************/
Kojto 109:9296ab0bfc11 604 HAL_TSC_StateTypeDef HAL_TSC_GetState(TSC_HandleTypeDef* htsc);
Kojto 109:9296ab0bfc11 605 HAL_StatusTypeDef HAL_TSC_PollForAcquisition(TSC_HandleTypeDef* htsc);
Kojto 109:9296ab0bfc11 606 void HAL_TSC_IRQHandler(TSC_HandleTypeDef* htsc);
Kojto 109:9296ab0bfc11 607 /**
Kojto 109:9296ab0bfc11 608 * @}
Kojto 109:9296ab0bfc11 609 */
Kojto 109:9296ab0bfc11 610
Kojto 109:9296ab0bfc11 611
Kojto 109:9296ab0bfc11 612 /* Callback functions *********************************************************/
Kojto 109:9296ab0bfc11 613 void HAL_TSC_ConvCpltCallback(TSC_HandleTypeDef* htsc);
Kojto 109:9296ab0bfc11 614 void HAL_TSC_ErrorCallback(TSC_HandleTypeDef* htsc);
Kojto 109:9296ab0bfc11 615 /**
Kojto 109:9296ab0bfc11 616 * @}
Kojto 109:9296ab0bfc11 617 */
Kojto 109:9296ab0bfc11 618
Kojto 109:9296ab0bfc11 619 /**
Kojto 109:9296ab0bfc11 620 * @}
Kojto 109:9296ab0bfc11 621 */
Kojto 109:9296ab0bfc11 622
Kojto 109:9296ab0bfc11 623 /**
Kojto 109:9296ab0bfc11 624 * @}
Kojto 109:9296ab0bfc11 625 */
Kojto 109:9296ab0bfc11 626
Kojto 109:9296ab0bfc11 627 #ifdef __cplusplus
Kojto 109:9296ab0bfc11 628 }
Kojto 109:9296ab0bfc11 629 #endif
Kojto 109:9296ab0bfc11 630
Kojto 109:9296ab0bfc11 631 #endif /*__STM32F3xx_TSC_H */
Kojto 109:9296ab0bfc11 632
Kojto 109:9296ab0bfc11 633 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/