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