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