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