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

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
<>
Date:
Wed Apr 12 16:07:08 2017 +0100
Revision:
140:97feb9bacc10
Parent:
128:9bcdf88f62b0
Child:
145:64910690c574
Release 140 of the mbed library

Ports for Upcoming Targets

3841: Add nRf52840 target https://github.com/ARMmbed/mbed-os/pull/3841
3992: Introducing UBLOX_C030 platform. https://github.com/ARMmbed/mbed-os/pull/3992

Fixes and Changes

3951: [NUCLEO_F303ZE] Correct ARDUINO pin https://github.com/ARMmbed/mbed-os/pull/3951
4021: Fixing a macro to detect when RTOS was in use for the NRF52840_DK https://github.com/ARMmbed/mbed-os/pull/4021
3979: KW24D: Add missing SPI defines and Arduino connector definitions https://github.com/ARMmbed/mbed-os/pull/3979
3990: UBLOX_C027: construct a ticker-based wait, rather than calling wait_ms(), in the https://github.com/ARMmbed/mbed-os/pull/3990
4003: Fixed OBOE in async serial tx for NRF52 target, fixes #4002 https://github.com/ARMmbed/mbed-os/pull/4003
4012: STM32: Correct I2C master error handling https://github.com/ARMmbed/mbed-os/pull/4012
4020: NUCLEO_L011K4 remove unsupported tool chain files https://github.com/ARMmbed/mbed-os/pull/4020
4065: K66F: Move bss section to m_data_2 Section https://github.com/ARMmbed/mbed-os/pull/4065
4014: Issue 3763: Reduce heap allocation in the GCC linker file https://github.com/ARMmbed/mbed-os/pull/4014
4030: [STM32L0] reduce IAR heap and stack size for small targets https://github.com/ARMmbed/mbed-os/pull/4030
4109: NUCLEO_L476RG : minor serial pin update https://github.com/ARMmbed/mbed-os/pull/4109
3982: Ticker - kl25z bugfix for handling events in the past https://github.com/ARMmbed/mbed-os/pull/3982

Who changed what in which revision?

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