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