mbed library sources

Dependents:   Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more

Superseded

This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.

Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.

If you are looking for a stable and tested release, please import one of the official mbed library releases:

Import librarymbed

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

Committer:
mbed_official
Date:
Mon Sep 28 10:45:10 2015 +0100
Revision:
630:825f75ca301e
Parent:
441:d2c15dda23c1
Synchronized with git revision 54fbe4144faf309c37205a5d39fa665daa919f10

Full URL: https://github.com/mbedmicro/mbed/commit/54fbe4144faf309c37205a5d39fa665daa919f10/

NUCLEO_F031K6 : Add new target

Who changed what in which revision?

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