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