Fork of the official mbed C/C SDK provides the software platform and libraries to build your applications for RenBED.
Dependents: 1-RenBuggyTimed RenBED_RGB RenBED_RGB_PWM RenBED_RGB
Fork of mbed by
TARGET_NUCLEO_L073RZ/stm32l0xx_hal_lptim.h@120:2eb10e18b8d7, 2016-04-13 (annotated)
- Committer:
- elijahorr
- Date:
- Wed Apr 13 12:29:27 2016 +0000
- Revision:
- 120:2eb10e18b8d7
- Parent:
- 116:c0f6e94411f5
V1.1
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Kojto | 116:c0f6e94411f5 | 1 | /** |
Kojto | 116:c0f6e94411f5 | 2 | ****************************************************************************** |
Kojto | 116:c0f6e94411f5 | 3 | * @file stm32l0xx_hal_lptim.h |
Kojto | 116:c0f6e94411f5 | 4 | * @author MCD Application Team |
Kojto | 116:c0f6e94411f5 | 5 | * @version V1.2.0 |
Kojto | 116:c0f6e94411f5 | 6 | * @date 06-February-2015 |
Kojto | 116:c0f6e94411f5 | 7 | * @brief Header file of LPTIM HAL module. |
Kojto | 116:c0f6e94411f5 | 8 | ****************************************************************************** |
Kojto | 116:c0f6e94411f5 | 9 | * @attention |
Kojto | 116:c0f6e94411f5 | 10 | * |
Kojto | 116:c0f6e94411f5 | 11 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
Kojto | 116:c0f6e94411f5 | 12 | * |
Kojto | 116:c0f6e94411f5 | 13 | * Redistribution and use in source and binary forms, with or without modification, |
Kojto | 116:c0f6e94411f5 | 14 | * are permitted provided that the following conditions are met: |
Kojto | 116:c0f6e94411f5 | 15 | * 1. Redistributions of source code must retain the above copyright notice, |
Kojto | 116:c0f6e94411f5 | 16 | * this list of conditions and the following disclaimer. |
Kojto | 116:c0f6e94411f5 | 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
Kojto | 116:c0f6e94411f5 | 18 | * this list of conditions and the following disclaimer in the documentation |
Kojto | 116:c0f6e94411f5 | 19 | * and/or other materials provided with the distribution. |
Kojto | 116:c0f6e94411f5 | 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
Kojto | 116:c0f6e94411f5 | 21 | * may be used to endorse or promote products derived from this software |
Kojto | 116:c0f6e94411f5 | 22 | * without specific prior written permission. |
Kojto | 116:c0f6e94411f5 | 23 | * |
Kojto | 116:c0f6e94411f5 | 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
Kojto | 116:c0f6e94411f5 | 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
Kojto | 116:c0f6e94411f5 | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
Kojto | 116:c0f6e94411f5 | 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
Kojto | 116:c0f6e94411f5 | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
Kojto | 116:c0f6e94411f5 | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
Kojto | 116:c0f6e94411f5 | 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
Kojto | 116:c0f6e94411f5 | 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
Kojto | 116:c0f6e94411f5 | 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
Kojto | 116:c0f6e94411f5 | 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Kojto | 116:c0f6e94411f5 | 34 | * |
Kojto | 116:c0f6e94411f5 | 35 | ****************************************************************************** |
Kojto | 116:c0f6e94411f5 | 36 | */ |
Kojto | 116:c0f6e94411f5 | 37 | |
Kojto | 116:c0f6e94411f5 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ |
Kojto | 116:c0f6e94411f5 | 39 | #ifndef __STM32L0xx_HAL_LPTIM_H |
Kojto | 116:c0f6e94411f5 | 40 | #define __STM32L0xx_HAL_LPTIM_H |
Kojto | 116:c0f6e94411f5 | 41 | |
Kojto | 116:c0f6e94411f5 | 42 | #ifdef __cplusplus |
Kojto | 116:c0f6e94411f5 | 43 | extern "C" { |
Kojto | 116:c0f6e94411f5 | 44 | #endif |
Kojto | 116:c0f6e94411f5 | 45 | |
Kojto | 116:c0f6e94411f5 | 46 | /* Includes ------------------------------------------------------------------*/ |
Kojto | 116:c0f6e94411f5 | 47 | #include "stm32l0xx_hal_def.h" |
Kojto | 116:c0f6e94411f5 | 48 | |
Kojto | 116:c0f6e94411f5 | 49 | /** @addtogroup STM32L0xx_HAL_Driver |
Kojto | 116:c0f6e94411f5 | 50 | * @{ |
Kojto | 116:c0f6e94411f5 | 51 | */ |
Kojto | 116:c0f6e94411f5 | 52 | |
Kojto | 116:c0f6e94411f5 | 53 | /** @defgroup LPTIM LPTIM (Low power timer) |
Kojto | 116:c0f6e94411f5 | 54 | * @{ |
Kojto | 116:c0f6e94411f5 | 55 | */ |
Kojto | 116:c0f6e94411f5 | 56 | |
Kojto | 116:c0f6e94411f5 | 57 | /* Exported types ------------------------------------------------------------*/ |
Kojto | 116:c0f6e94411f5 | 58 | /** @defgroup TIM_Exported_Types TIM Exported Types |
Kojto | 116:c0f6e94411f5 | 59 | * @{ |
Kojto | 116:c0f6e94411f5 | 60 | */ |
Kojto | 116:c0f6e94411f5 | 61 | |
Kojto | 116:c0f6e94411f5 | 62 | /** @defgroup LPTIM_Clock_Configuration LPTIM Clock configuration structure |
Kojto | 116:c0f6e94411f5 | 63 | * @{ |
Kojto | 116:c0f6e94411f5 | 64 | */ |
Kojto | 116:c0f6e94411f5 | 65 | /** |
Kojto | 116:c0f6e94411f5 | 66 | * @brief LPTIM Clock configuration definition |
Kojto | 116:c0f6e94411f5 | 67 | */ |
Kojto | 116:c0f6e94411f5 | 68 | typedef struct |
Kojto | 116:c0f6e94411f5 | 69 | { |
Kojto | 116:c0f6e94411f5 | 70 | uint32_t Source; /*!< Selects the clock source. |
Kojto | 116:c0f6e94411f5 | 71 | This parameter can be a value of @ref LPTIM_Clock_Source */ |
Kojto | 116:c0f6e94411f5 | 72 | |
Kojto | 116:c0f6e94411f5 | 73 | uint32_t Prescaler; /*!< Specifies the counter clock Prescaler. |
Kojto | 116:c0f6e94411f5 | 74 | This parameter can be a value of @ref LPTIM_Clock_Prescaler */ |
Kojto | 116:c0f6e94411f5 | 75 | |
Kojto | 116:c0f6e94411f5 | 76 | }LPTIM_ClockConfigTypeDef; |
Kojto | 116:c0f6e94411f5 | 77 | /** |
Kojto | 116:c0f6e94411f5 | 78 | * @} |
Kojto | 116:c0f6e94411f5 | 79 | */ |
Kojto | 116:c0f6e94411f5 | 80 | |
Kojto | 116:c0f6e94411f5 | 81 | /** @defgroup LPTIM_ULPClock_Configuration LPTIM ULP Clock configuration structure |
Kojto | 116:c0f6e94411f5 | 82 | * @{ |
Kojto | 116:c0f6e94411f5 | 83 | */ |
Kojto | 116:c0f6e94411f5 | 84 | /** |
Kojto | 116:c0f6e94411f5 | 85 | * @brief LPTIM ULP Clock configuration definition |
Kojto | 116:c0f6e94411f5 | 86 | */ |
Kojto | 116:c0f6e94411f5 | 87 | typedef struct |
Kojto | 116:c0f6e94411f5 | 88 | { |
Kojto | 116:c0f6e94411f5 | 89 | uint32_t Polarity; /*!< Selects the polarity of the active edge for the counter unit |
Kojto | 116:c0f6e94411f5 | 90 | if the ULPTIM input is selected. |
Kojto | 116:c0f6e94411f5 | 91 | Note: This parameter is used only when Ultra low power clock source is used. |
Kojto | 116:c0f6e94411f5 | 92 | Note: If the polarity is configured on 'both edges', an auxiliary clock |
Kojto | 116:c0f6e94411f5 | 93 | (one of the Low power oscillator) must be active. |
Kojto | 116:c0f6e94411f5 | 94 | This parameter can be a value of @ref LPTIM_Clock_Polarity */ |
Kojto | 116:c0f6e94411f5 | 95 | |
Kojto | 116:c0f6e94411f5 | 96 | uint32_t SampleTime; /*!< Selects the clock sampling time to configure the clock glitch filter. |
Kojto | 116:c0f6e94411f5 | 97 | Note: This parameter is used only when Ultra low power clock source is used. |
Kojto | 116:c0f6e94411f5 | 98 | This parameter can be a value of @ref LPTIM_Clock_Sample_Time */ |
Kojto | 116:c0f6e94411f5 | 99 | |
Kojto | 116:c0f6e94411f5 | 100 | }LPTIM_ULPClockConfigTypeDef; |
Kojto | 116:c0f6e94411f5 | 101 | /** |
Kojto | 116:c0f6e94411f5 | 102 | * @} |
Kojto | 116:c0f6e94411f5 | 103 | */ |
Kojto | 116:c0f6e94411f5 | 104 | |
Kojto | 116:c0f6e94411f5 | 105 | /** @defgroup LPTIM_Trigger_Configuration LPTIM Trigger configuration structure |
Kojto | 116:c0f6e94411f5 | 106 | * @{ |
Kojto | 116:c0f6e94411f5 | 107 | */ |
Kojto | 116:c0f6e94411f5 | 108 | /** |
Kojto | 116:c0f6e94411f5 | 109 | * @brief LPTIM Trigger configuration structure |
Kojto | 116:c0f6e94411f5 | 110 | */ |
Kojto | 116:c0f6e94411f5 | 111 | typedef struct |
Kojto | 116:c0f6e94411f5 | 112 | { |
Kojto | 116:c0f6e94411f5 | 113 | uint32_t Source; /*!< Selects the Trigger source. |
Kojto | 116:c0f6e94411f5 | 114 | This parameter can be a value of @ref LPTIM_Trigger_Source */ |
Kojto | 116:c0f6e94411f5 | 115 | |
Kojto | 116:c0f6e94411f5 | 116 | uint32_t ActiveEdge; /*!< Selects the Trigger active edge. |
Kojto | 116:c0f6e94411f5 | 117 | Note: This parameter is used only when an external trigger is used. |
Kojto | 116:c0f6e94411f5 | 118 | This parameter can be a value of @ref LPTIM_External_Trigger_Polarity */ |
Kojto | 116:c0f6e94411f5 | 119 | |
Kojto | 116:c0f6e94411f5 | 120 | uint32_t SampleTime; /*!< Selects the trigger sampling time to configure the clock glitch filter. |
Kojto | 116:c0f6e94411f5 | 121 | Note: This parameter is used only when an external trigger is used. |
Kojto | 116:c0f6e94411f5 | 122 | This parameter can be a value of @ref LPTIM_Trigger_Sample_Time */ |
Kojto | 116:c0f6e94411f5 | 123 | }LPTIM_TriggerConfigTypeDef; |
Kojto | 116:c0f6e94411f5 | 124 | /** |
Kojto | 116:c0f6e94411f5 | 125 | * @} |
Kojto | 116:c0f6e94411f5 | 126 | */ |
Kojto | 116:c0f6e94411f5 | 127 | |
Kojto | 116:c0f6e94411f5 | 128 | /** @defgroup LPTIM_Init_Configuration LPTIM Initialization configuration structure |
Kojto | 116:c0f6e94411f5 | 129 | * @{ |
Kojto | 116:c0f6e94411f5 | 130 | */ |
Kojto | 116:c0f6e94411f5 | 131 | /** |
Kojto | 116:c0f6e94411f5 | 132 | * @brief LPTIM Initialization Structure definition |
Kojto | 116:c0f6e94411f5 | 133 | */ |
Kojto | 116:c0f6e94411f5 | 134 | typedef struct |
Kojto | 116:c0f6e94411f5 | 135 | { |
Kojto | 116:c0f6e94411f5 | 136 | LPTIM_ClockConfigTypeDef Clock; /*!< Specifies the clock parameters */ |
Kojto | 116:c0f6e94411f5 | 137 | |
Kojto | 116:c0f6e94411f5 | 138 | LPTIM_ULPClockConfigTypeDef UltraLowPowerClock; /*!< Specifies the Ultra Low Power clock parameters */ |
Kojto | 116:c0f6e94411f5 | 139 | |
Kojto | 116:c0f6e94411f5 | 140 | LPTIM_TriggerConfigTypeDef Trigger; /*!< Specifies the Trigger parameters */ |
Kojto | 116:c0f6e94411f5 | 141 | |
Kojto | 116:c0f6e94411f5 | 142 | uint32_t OutputPolarity; /*!< Specifies the Output polarity. |
Kojto | 116:c0f6e94411f5 | 143 | This parameter can be a value of @ref LPTIM_Output_Polarity */ |
Kojto | 116:c0f6e94411f5 | 144 | |
Kojto | 116:c0f6e94411f5 | 145 | uint32_t UpdateMode; /*!< Specifies whether the update of the autorelaod and the compare |
Kojto | 116:c0f6e94411f5 | 146 | values is done immediately or after the end of current period. |
Kojto | 116:c0f6e94411f5 | 147 | This parameter can be a value of @ref LPTIM_Updating_Mode */ |
Kojto | 116:c0f6e94411f5 | 148 | |
Kojto | 116:c0f6e94411f5 | 149 | uint32_t CounterSource; /*!< Specifies whether the counter is incremented each internal event |
Kojto | 116:c0f6e94411f5 | 150 | or each external event. |
Kojto | 116:c0f6e94411f5 | 151 | This parameter can be a value of @ref LPTIM_Counter_Source */ |
Kojto | 116:c0f6e94411f5 | 152 | |
Kojto | 116:c0f6e94411f5 | 153 | }LPTIM_InitTypeDef; |
Kojto | 116:c0f6e94411f5 | 154 | /** |
Kojto | 116:c0f6e94411f5 | 155 | * @} |
Kojto | 116:c0f6e94411f5 | 156 | */ |
Kojto | 116:c0f6e94411f5 | 157 | /** @defgroup LPTIM_State_structure LPTIM state definition |
Kojto | 116:c0f6e94411f5 | 158 | * @{ |
Kojto | 116:c0f6e94411f5 | 159 | */ |
Kojto | 116:c0f6e94411f5 | 160 | /** |
Kojto | 116:c0f6e94411f5 | 161 | * @brief HAL LPTIM State structure definition |
Kojto | 116:c0f6e94411f5 | 162 | */ |
Kojto | 116:c0f6e94411f5 | 163 | typedef enum __HAL_LPTIM_StateTypeDef |
Kojto | 116:c0f6e94411f5 | 164 | { |
Kojto | 116:c0f6e94411f5 | 165 | HAL_LPTIM_STATE_RESET = 0x00, /*!< Peripheral not yet initialized or disabled */ |
Kojto | 116:c0f6e94411f5 | 166 | HAL_LPTIM_STATE_READY = 0x01, /*!< Peripheral Initialized and ready for use */ |
Kojto | 116:c0f6e94411f5 | 167 | HAL_LPTIM_STATE_BUSY = 0x02, /*!< An internal process is ongoing */ |
Kojto | 116:c0f6e94411f5 | 168 | HAL_LPTIM_STATE_TIMEOUT = 0x03, /*!< Timeout state */ |
Kojto | 116:c0f6e94411f5 | 169 | HAL_LPTIM_STATE_ERROR = 0x04 /*!< Internal Process is ongoing */ |
Kojto | 116:c0f6e94411f5 | 170 | }HAL_LPTIM_StateTypeDef; |
Kojto | 116:c0f6e94411f5 | 171 | /** |
Kojto | 116:c0f6e94411f5 | 172 | * @} |
Kojto | 116:c0f6e94411f5 | 173 | */ |
Kojto | 116:c0f6e94411f5 | 174 | |
Kojto | 116:c0f6e94411f5 | 175 | /** @defgroup LPTIM_Handle LPTIM handler |
Kojto | 116:c0f6e94411f5 | 176 | * @{ |
Kojto | 116:c0f6e94411f5 | 177 | */ |
Kojto | 116:c0f6e94411f5 | 178 | /** |
Kojto | 116:c0f6e94411f5 | 179 | * @brief LPTIM handle Structure definition |
Kojto | 116:c0f6e94411f5 | 180 | */ |
Kojto | 116:c0f6e94411f5 | 181 | typedef struct |
Kojto | 116:c0f6e94411f5 | 182 | { |
Kojto | 116:c0f6e94411f5 | 183 | LPTIM_TypeDef *Instance; /*!< Register base address */ |
Kojto | 116:c0f6e94411f5 | 184 | |
Kojto | 116:c0f6e94411f5 | 185 | LPTIM_InitTypeDef Init; /*!< LPTIM required parameters */ |
Kojto | 116:c0f6e94411f5 | 186 | |
Kojto | 116:c0f6e94411f5 | 187 | HAL_StatusTypeDef Status; /*!< LPTIM peripheral status */ |
Kojto | 116:c0f6e94411f5 | 188 | |
Kojto | 116:c0f6e94411f5 | 189 | HAL_LockTypeDef Lock; /*!< LPTIM locking object */ |
Kojto | 116:c0f6e94411f5 | 190 | |
Kojto | 116:c0f6e94411f5 | 191 | __IO HAL_LPTIM_StateTypeDef State; /*!< LPTIM peripheral state */ |
Kojto | 116:c0f6e94411f5 | 192 | |
Kojto | 116:c0f6e94411f5 | 193 | }LPTIM_HandleTypeDef; |
Kojto | 116:c0f6e94411f5 | 194 | |
Kojto | 116:c0f6e94411f5 | 195 | /** |
Kojto | 116:c0f6e94411f5 | 196 | * @} |
Kojto | 116:c0f6e94411f5 | 197 | */ |
Kojto | 116:c0f6e94411f5 | 198 | /** |
Kojto | 116:c0f6e94411f5 | 199 | * @} |
Kojto | 116:c0f6e94411f5 | 200 | */ |
Kojto | 116:c0f6e94411f5 | 201 | |
Kojto | 116:c0f6e94411f5 | 202 | /* Exported constants --------------------------------------------------------*/ |
Kojto | 116:c0f6e94411f5 | 203 | |
Kojto | 116:c0f6e94411f5 | 204 | /** @defgroup LPTIM_Exported_Constants LPTIM Exported constants |
Kojto | 116:c0f6e94411f5 | 205 | * @{ |
Kojto | 116:c0f6e94411f5 | 206 | */ |
Kojto | 116:c0f6e94411f5 | 207 | |
Kojto | 116:c0f6e94411f5 | 208 | /* Check autoreload value */ |
Kojto | 116:c0f6e94411f5 | 209 | #define IS_LPTIM_AUTORELOAD(__AUTORELOAD__) ((__AUTORELOAD__) <= 0x0000FFFF) |
Kojto | 116:c0f6e94411f5 | 210 | |
Kojto | 116:c0f6e94411f5 | 211 | /* Check compare value */ |
Kojto | 116:c0f6e94411f5 | 212 | #define IS_LPTIM_COMPARE(__COMPARE__) ((__COMPARE__) <= 0x0000FFFF) |
Kojto | 116:c0f6e94411f5 | 213 | |
Kojto | 116:c0f6e94411f5 | 214 | /** @defgroup LPTIM_Clock_Source Clock source |
Kojto | 116:c0f6e94411f5 | 215 | * @{ |
Kojto | 116:c0f6e94411f5 | 216 | */ |
Kojto | 116:c0f6e94411f5 | 217 | #define LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC ((uint32_t)0x00) |
Kojto | 116:c0f6e94411f5 | 218 | #define LPTIM_CLOCKSOURCE_ULPTIM LPTIM_CFGR_CKSEL |
Kojto | 116:c0f6e94411f5 | 219 | /** |
Kojto | 116:c0f6e94411f5 | 220 | * @} |
Kojto | 116:c0f6e94411f5 | 221 | */ |
Kojto | 116:c0f6e94411f5 | 222 | #define IS_LPTIM_CLOCK_SOURCE(__SOURCE__) (((__SOURCE__) == LPTIM_CLOCKSOURCE_ULPTIM) || \ |
Kojto | 116:c0f6e94411f5 | 223 | ((__SOURCE__) == LPTIM_CLOCKSOURCE_APBCLOCK_LPOSC)) |
Kojto | 116:c0f6e94411f5 | 224 | |
Kojto | 116:c0f6e94411f5 | 225 | |
Kojto | 116:c0f6e94411f5 | 226 | /** @defgroup LPTIM_Clock_Prescaler Prescaler |
Kojto | 116:c0f6e94411f5 | 227 | * @{ |
Kojto | 116:c0f6e94411f5 | 228 | */ |
Kojto | 116:c0f6e94411f5 | 229 | #define LPTIM_PRESCALER_DIV1 ((uint32_t)0x000000) |
Kojto | 116:c0f6e94411f5 | 230 | #define LPTIM_PRESCALER_DIV2 LPTIM_CFGR_PRESC_0 |
Kojto | 116:c0f6e94411f5 | 231 | #define LPTIM_PRESCALER_DIV4 LPTIM_CFGR_PRESC_1 |
Kojto | 116:c0f6e94411f5 | 232 | #define LPTIM_PRESCALER_DIV8 ((uint32_t)(LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_1)) |
Kojto | 116:c0f6e94411f5 | 233 | #define LPTIM_PRESCALER_DIV16 LPTIM_CFGR_PRESC_2 |
Kojto | 116:c0f6e94411f5 | 234 | #define LPTIM_PRESCALER_DIV32 ((uint32_t)(LPTIM_CFGR_PRESC_0 | LPTIM_CFGR_PRESC_2)) |
Kojto | 116:c0f6e94411f5 | 235 | #define LPTIM_PRESCALER_DIV64 ((uint32_t)(LPTIM_CFGR_PRESC_1 | LPTIM_CFGR_PRESC_2)) |
Kojto | 116:c0f6e94411f5 | 236 | #define LPTIM_PRESCALER_DIV128 ((uint32_t)LPTIM_CFGR_PRESC) |
Kojto | 116:c0f6e94411f5 | 237 | /** |
Kojto | 116:c0f6e94411f5 | 238 | * @} |
Kojto | 116:c0f6e94411f5 | 239 | */ |
Kojto | 116:c0f6e94411f5 | 240 | |
Kojto | 116:c0f6e94411f5 | 241 | #define IS_LPTIM_CLOCK_PRESCALER(__PRESCALER__) (((__PRESCALER__) == LPTIM_PRESCALER_DIV1 ) || \ |
Kojto | 116:c0f6e94411f5 | 242 | ((__PRESCALER__) == LPTIM_PRESCALER_DIV2 ) || \ |
Kojto | 116:c0f6e94411f5 | 243 | ((__PRESCALER__) == LPTIM_PRESCALER_DIV4 ) || \ |
Kojto | 116:c0f6e94411f5 | 244 | ((__PRESCALER__) == LPTIM_PRESCALER_DIV8 ) || \ |
Kojto | 116:c0f6e94411f5 | 245 | ((__PRESCALER__) == LPTIM_PRESCALER_DIV16 ) || \ |
Kojto | 116:c0f6e94411f5 | 246 | ((__PRESCALER__) == LPTIM_PRESCALER_DIV32 ) || \ |
Kojto | 116:c0f6e94411f5 | 247 | ((__PRESCALER__) == LPTIM_PRESCALER_DIV64 ) || \ |
Kojto | 116:c0f6e94411f5 | 248 | ((__PRESCALER__) == LPTIM_PRESCALER_DIV128)) |
Kojto | 116:c0f6e94411f5 | 249 | |
Kojto | 116:c0f6e94411f5 | 250 | #define IS_LPTIM_CLOCK_PRESCALERDIV1(__PRESCALER__) ((__PRESCALER__) == LPTIM_PRESCALER_DIV1) |
Kojto | 116:c0f6e94411f5 | 251 | |
Kojto | 116:c0f6e94411f5 | 252 | |
Kojto | 116:c0f6e94411f5 | 253 | /** @defgroup LPTIM_Output_Polarity Output polarity |
Kojto | 116:c0f6e94411f5 | 254 | * @{ |
Kojto | 116:c0f6e94411f5 | 255 | */ |
Kojto | 116:c0f6e94411f5 | 256 | #define LPTIM_OUTPUTPOLARITY_HIGH ((uint32_t)0x00000000) |
Kojto | 116:c0f6e94411f5 | 257 | #define LPTIM_OUTPUTPOLARITY_LOW (LPTIM_CFGR_WAVPOL) |
Kojto | 116:c0f6e94411f5 | 258 | /** |
Kojto | 116:c0f6e94411f5 | 259 | * @} |
Kojto | 116:c0f6e94411f5 | 260 | */ |
Kojto | 116:c0f6e94411f5 | 261 | #define IS_LPTIM_OUTPUT_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_OUTPUTPOLARITY_LOW ) || \ |
Kojto | 116:c0f6e94411f5 | 262 | ((__POLARITY__) == LPTIM_OUTPUTPOLARITY_HIGH)) |
Kojto | 116:c0f6e94411f5 | 263 | |
Kojto | 116:c0f6e94411f5 | 264 | /** @defgroup LPTIM_Clock_Sample_Time Clock sample time |
Kojto | 116:c0f6e94411f5 | 265 | * @{ |
Kojto | 116:c0f6e94411f5 | 266 | */ |
Kojto | 116:c0f6e94411f5 | 267 | #define LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION ((uint32_t)0x00000000) |
Kojto | 116:c0f6e94411f5 | 268 | #define LPTIM_CLOCKSAMPLETIME_2TRANSITIONS LPTIM_CFGR_CKFLT_0 |
Kojto | 116:c0f6e94411f5 | 269 | #define LPTIM_CLOCKSAMPLETIME_4TRANSITIONS LPTIM_CFGR_CKFLT_1 |
Kojto | 116:c0f6e94411f5 | 270 | #define LPTIM_CLOCKSAMPLETIME_8TRANSITIONS LPTIM_CFGR_CKFLT |
Kojto | 116:c0f6e94411f5 | 271 | /** |
Kojto | 116:c0f6e94411f5 | 272 | * @} |
Kojto | 116:c0f6e94411f5 | 273 | */ |
Kojto | 116:c0f6e94411f5 | 274 | #define IS_LPTIM_CLOCK_SAMPLE_TIME(__SAMPLETIME__) (((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_DIRECTTRANSITION) || \ |
Kojto | 116:c0f6e94411f5 | 275 | ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_2TRANSITIONS) || \ |
Kojto | 116:c0f6e94411f5 | 276 | ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_4TRANSITIONS) || \ |
Kojto | 116:c0f6e94411f5 | 277 | ((__SAMPLETIME__) == LPTIM_CLOCKSAMPLETIME_8TRANSITIONS)) |
Kojto | 116:c0f6e94411f5 | 278 | |
Kojto | 116:c0f6e94411f5 | 279 | /** @defgroup LPTIM_Clock_Polarity Clock polarity |
Kojto | 116:c0f6e94411f5 | 280 | * @{ |
Kojto | 116:c0f6e94411f5 | 281 | */ |
Kojto | 116:c0f6e94411f5 | 282 | #define LPTIM_CLOCKPOLARITY_RISING ((uint32_t)0x00000000) |
Kojto | 116:c0f6e94411f5 | 283 | #define LPTIM_CLOCKPOLARITY_FALLING LPTIM_CFGR_CKPOL_0 |
Kojto | 116:c0f6e94411f5 | 284 | #define LPTIM_CLOCKPOLARITY_RISING_FALLING LPTIM_CFGR_CKPOL_1 |
Kojto | 116:c0f6e94411f5 | 285 | /** |
Kojto | 116:c0f6e94411f5 | 286 | * @} |
Kojto | 116:c0f6e94411f5 | 287 | */ |
Kojto | 116:c0f6e94411f5 | 288 | |
Kojto | 116:c0f6e94411f5 | 289 | #define IS_LPTIM_CLOCK_POLARITY(__POLARITY__) (((__POLARITY__) == LPTIM_CLOCKPOLARITY_RISING) || \ |
Kojto | 116:c0f6e94411f5 | 290 | ((__POLARITY__) == LPTIM_CLOCKPOLARITY_FALLING) || \ |
Kojto | 116:c0f6e94411f5 | 291 | ((__POLARITY__) == LPTIM_CLOCKPOLARITY_RISING_FALLING)) |
Kojto | 116:c0f6e94411f5 | 292 | |
Kojto | 116:c0f6e94411f5 | 293 | /** @defgroup LPTIM_External_Trigger_Polarity Trigger polarity |
Kojto | 116:c0f6e94411f5 | 294 | * @{ |
Kojto | 116:c0f6e94411f5 | 295 | */ |
Kojto | 116:c0f6e94411f5 | 296 | #define LPTIM_ACTIVEEDGE_RISING LPTIM_CFGR_TRIGEN_0 |
Kojto | 116:c0f6e94411f5 | 297 | #define LPTIM_ACTIVEEDGE_FALLING LPTIM_CFGR_TRIGEN_1 |
Kojto | 116:c0f6e94411f5 | 298 | #define LPTIM_ACTIVEEDGE_RISING_FALLING LPTIM_CFGR_TRIGEN |
Kojto | 116:c0f6e94411f5 | 299 | /** |
Kojto | 116:c0f6e94411f5 | 300 | * @} |
Kojto | 116:c0f6e94411f5 | 301 | */ |
Kojto | 116:c0f6e94411f5 | 302 | #define IS_LPTIM_EXT_TRG_POLARITY(__POLAR__) (((__POLAR__) == LPTIM_ACTIVEEDGE_RISING ) || \ |
Kojto | 116:c0f6e94411f5 | 303 | ((__POLAR__) == LPTIM_ACTIVEEDGE_FALLING ) || \ |
Kojto | 116:c0f6e94411f5 | 304 | ((__POLAR__) == LPTIM_ACTIVEEDGE_RISING_FALLING )) |
Kojto | 116:c0f6e94411f5 | 305 | |
Kojto | 116:c0f6e94411f5 | 306 | /** @defgroup LPTIM_Trigger_Sample_Time Trigger sample time |
Kojto | 116:c0f6e94411f5 | 307 | * @{ |
Kojto | 116:c0f6e94411f5 | 308 | */ |
Kojto | 116:c0f6e94411f5 | 309 | #define LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION ((uint32_t)0x00000000) |
Kojto | 116:c0f6e94411f5 | 310 | #define LPTIM_TRIGSAMPLETIME_2TRANSITIONS LPTIM_CFGR_TRGFLT_0 |
Kojto | 116:c0f6e94411f5 | 311 | #define LPTIM_TRIGSAMPLETIME_4TRANSITIONS LPTIM_CFGR_TRGFLT_1 |
Kojto | 116:c0f6e94411f5 | 312 | #define LPTIM_TRIGSAMPLETIME_8TRANSITIONS LPTIM_CFGR_TRGFLT |
Kojto | 116:c0f6e94411f5 | 313 | /** |
Kojto | 116:c0f6e94411f5 | 314 | * @} |
Kojto | 116:c0f6e94411f5 | 315 | */ |
Kojto | 116:c0f6e94411f5 | 316 | #define IS_LPTIM_TRIG_SAMPLE_TIME(__SAMPLETIME__) (((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_DIRECTTRANSITION ) || \ |
Kojto | 116:c0f6e94411f5 | 317 | ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_2TRANSITIONS ) || \ |
Kojto | 116:c0f6e94411f5 | 318 | ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_4TRANSITIONS ) || \ |
Kojto | 116:c0f6e94411f5 | 319 | ((__SAMPLETIME__) == LPTIM_TRIGSAMPLETIME_8TRANSITIONS )) |
Kojto | 116:c0f6e94411f5 | 320 | |
Kojto | 116:c0f6e94411f5 | 321 | |
Kojto | 116:c0f6e94411f5 | 322 | /** @defgroup LPTIM_Updating_Mode Updating mode |
Kojto | 116:c0f6e94411f5 | 323 | * @{ |
Kojto | 116:c0f6e94411f5 | 324 | */ |
Kojto | 116:c0f6e94411f5 | 325 | |
Kojto | 116:c0f6e94411f5 | 326 | #define LPTIM_UPDATE_IMMEDIATE ((uint32_t)0x00000000) |
Kojto | 116:c0f6e94411f5 | 327 | #define LPTIM_UPDATE_ENDOFPERIOD LPTIM_CFGR_PRELOAD |
Kojto | 116:c0f6e94411f5 | 328 | /** |
Kojto | 116:c0f6e94411f5 | 329 | * @} |
Kojto | 116:c0f6e94411f5 | 330 | */ |
Kojto | 116:c0f6e94411f5 | 331 | #define IS_LPTIM_UPDATE_MODE(__MODE__) (((__MODE__) == LPTIM_UPDATE_IMMEDIATE) || \ |
Kojto | 116:c0f6e94411f5 | 332 | ((__MODE__) == LPTIM_UPDATE_ENDOFPERIOD)) |
Kojto | 116:c0f6e94411f5 | 333 | |
Kojto | 116:c0f6e94411f5 | 334 | |
Kojto | 116:c0f6e94411f5 | 335 | |
Kojto | 116:c0f6e94411f5 | 336 | /** @defgroup LPTIM_Counter_Source Counter source |
Kojto | 116:c0f6e94411f5 | 337 | * @{ |
Kojto | 116:c0f6e94411f5 | 338 | */ |
Kojto | 116:c0f6e94411f5 | 339 | #define LPTIM_COUNTERSOURCE_INTERNAL ((uint32_t)0x00000000) |
Kojto | 116:c0f6e94411f5 | 340 | #define LPTIM_COUNTERSOURCE_EXTERNAL LPTIM_CFGR_COUNTMODE |
Kojto | 116:c0f6e94411f5 | 341 | /** |
Kojto | 116:c0f6e94411f5 | 342 | * @} |
Kojto | 116:c0f6e94411f5 | 343 | */ |
Kojto | 116:c0f6e94411f5 | 344 | #define IS_LPTIM_COUNTER_SOURCE(__SOURCE__) (((__SOURCE__) == LPTIM_COUNTERSOURCE_INTERNAL) || \ |
Kojto | 116:c0f6e94411f5 | 345 | ((__SOURCE__) == LPTIM_COUNTERSOURCE_EXTERNAL)) |
Kojto | 116:c0f6e94411f5 | 346 | |
Kojto | 116:c0f6e94411f5 | 347 | |
Kojto | 116:c0f6e94411f5 | 348 | |
Kojto | 116:c0f6e94411f5 | 349 | /* Check for period value */ |
Kojto | 116:c0f6e94411f5 | 350 | #define IS_LPTIM_PERIOD(__PERIOD__) ((__PERIOD__) <= 0x0000FFFF) |
Kojto | 116:c0f6e94411f5 | 351 | |
Kojto | 116:c0f6e94411f5 | 352 | /* Check for pulse value */ |
Kojto | 116:c0f6e94411f5 | 353 | #define IS_LPTIM_PULSE(__PULSE__) ((__PULSE__) <= 0x0000FFFF) |
Kojto | 116:c0f6e94411f5 | 354 | |
Kojto | 116:c0f6e94411f5 | 355 | /** @defgroup LPTIM_Flag_Definition Flag definition |
Kojto | 116:c0f6e94411f5 | 356 | * @{ |
Kojto | 116:c0f6e94411f5 | 357 | */ |
Kojto | 116:c0f6e94411f5 | 358 | #define LPTIM_FLAG_DOWN LPTIM_ISR_DOWN |
Kojto | 116:c0f6e94411f5 | 359 | #define LPTIM_FLAG_UP LPTIM_ISR_UP |
Kojto | 116:c0f6e94411f5 | 360 | #define LPTIM_FLAG_ARROK LPTIM_ISR_ARROK |
Kojto | 116:c0f6e94411f5 | 361 | #define LPTIM_FLAG_CMPOK LPTIM_ISR_CMPOK |
Kojto | 116:c0f6e94411f5 | 362 | #define LPTIM_FLAG_EXTTRIG LPTIM_ISR_EXTTRIG |
Kojto | 116:c0f6e94411f5 | 363 | #define LPTIM_FLAG_ARRM LPTIM_ISR_ARRM |
Kojto | 116:c0f6e94411f5 | 364 | #define LPTIM_FLAG_CMPM LPTIM_ISR_CMPM |
Kojto | 116:c0f6e94411f5 | 365 | /** |
Kojto | 116:c0f6e94411f5 | 366 | * @} |
Kojto | 116:c0f6e94411f5 | 367 | */ |
Kojto | 116:c0f6e94411f5 | 368 | |
Kojto | 116:c0f6e94411f5 | 369 | /** @defgroup LPTIM_Interrupts_Definition Interrupts definition |
Kojto | 116:c0f6e94411f5 | 370 | * @{ |
Kojto | 116:c0f6e94411f5 | 371 | */ |
Kojto | 116:c0f6e94411f5 | 372 | #define LPTIM_IT_DOWN LPTIM_IER_DOWNIE |
Kojto | 116:c0f6e94411f5 | 373 | #define LPTIM_IT_UP LPTIM_IER_UPIE |
Kojto | 116:c0f6e94411f5 | 374 | #define LPTIM_IT_ARROK LPTIM_IER_ARROKIE |
Kojto | 116:c0f6e94411f5 | 375 | #define LPTIM_IT_CMPOK LPTIM_IER_CMPOKIE |
Kojto | 116:c0f6e94411f5 | 376 | #define LPTIM_IT_EXTTRIG LPTIM_IER_EXTTRIGIE |
Kojto | 116:c0f6e94411f5 | 377 | #define LPTIM_IT_ARRM LPTIM_IER_ARRMIE |
Kojto | 116:c0f6e94411f5 | 378 | #define LPTIM_IT_CMPM LPTIM_IER_CMPMIE |
Kojto | 116:c0f6e94411f5 | 379 | /** |
Kojto | 116:c0f6e94411f5 | 380 | * @} |
Kojto | 116:c0f6e94411f5 | 381 | */ |
Kojto | 116:c0f6e94411f5 | 382 | |
Kojto | 116:c0f6e94411f5 | 383 | /** |
Kojto | 116:c0f6e94411f5 | 384 | * @} |
Kojto | 116:c0f6e94411f5 | 385 | */ |
Kojto | 116:c0f6e94411f5 | 386 | |
Kojto | 116:c0f6e94411f5 | 387 | /* Exported macro ------------------------------------------------------------*/ |
Kojto | 116:c0f6e94411f5 | 388 | |
Kojto | 116:c0f6e94411f5 | 389 | /** @defgroup LPTIM_Exported_Macros LPTIM Exported Macros |
Kojto | 116:c0f6e94411f5 | 390 | * @{ |
Kojto | 116:c0f6e94411f5 | 391 | */ |
Kojto | 116:c0f6e94411f5 | 392 | |
Kojto | 116:c0f6e94411f5 | 393 | /** @brief Reset LPTIM handle state |
Kojto | 116:c0f6e94411f5 | 394 | * @param __HANDLE__: LPTIM handle |
Kojto | 116:c0f6e94411f5 | 395 | * @retval None |
Kojto | 116:c0f6e94411f5 | 396 | */ |
Kojto | 116:c0f6e94411f5 | 397 | #define __HAL_LPTIM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_LPTIM_STATE_RESET) |
Kojto | 116:c0f6e94411f5 | 398 | |
Kojto | 116:c0f6e94411f5 | 399 | /** |
Kojto | 116:c0f6e94411f5 | 400 | * @brief Enable/Disable the LPTIM peripheral. |
Kojto | 116:c0f6e94411f5 | 401 | * @param __HANDLE__: LPTIM handle |
Kojto | 116:c0f6e94411f5 | 402 | * @retval None |
Kojto | 116:c0f6e94411f5 | 403 | */ |
Kojto | 116:c0f6e94411f5 | 404 | #define __HAL_LPTIM_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= (LPTIM_CR_ENABLE)) |
Kojto | 116:c0f6e94411f5 | 405 | #define __HAL_LPTIM_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(LPTIM_CR_ENABLE)) |
Kojto | 116:c0f6e94411f5 | 406 | |
Kojto | 116:c0f6e94411f5 | 407 | /** |
Kojto | 116:c0f6e94411f5 | 408 | * @brief Starts the LPTIM peripheral in Continuous or in single mode. |
Kojto | 116:c0f6e94411f5 | 409 | * @param __HANDLE__: DMA handle |
Kojto | 116:c0f6e94411f5 | 410 | * @retval None |
Kojto | 116:c0f6e94411f5 | 411 | */ |
Kojto | 116:c0f6e94411f5 | 412 | #define __HAL_LPTIM_START_CONTINUOUS(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_CNTSTRT) |
Kojto | 116:c0f6e94411f5 | 413 | #define __HAL_LPTIM_START_SINGLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= LPTIM_CR_SNGSTRT) |
Kojto | 116:c0f6e94411f5 | 414 | |
Kojto | 116:c0f6e94411f5 | 415 | |
Kojto | 116:c0f6e94411f5 | 416 | /** |
Kojto | 116:c0f6e94411f5 | 417 | * @brief Writes the passed parameter in the Autoreload register. |
Kojto | 116:c0f6e94411f5 | 418 | * @param __HANDLE__: LPTIM handle |
Kojto | 116:c0f6e94411f5 | 419 | * @param __VALUE__ : Autoreload value |
Kojto | 116:c0f6e94411f5 | 420 | * @retval None |
Kojto | 116:c0f6e94411f5 | 421 | */ |
Kojto | 116:c0f6e94411f5 | 422 | #define __HAL_LPTIM_AUTORELOAD_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->ARR = (__VALUE__)) |
Kojto | 116:c0f6e94411f5 | 423 | |
Kojto | 116:c0f6e94411f5 | 424 | /** |
Kojto | 116:c0f6e94411f5 | 425 | * @brief Writes the passed parameter in the Compare register. |
Kojto | 116:c0f6e94411f5 | 426 | * @param __HANDLE__: LPTIM handle |
Kojto | 116:c0f6e94411f5 | 427 | * @param __VALUE__ : Compare value |
Kojto | 116:c0f6e94411f5 | 428 | * @retval None |
Kojto | 116:c0f6e94411f5 | 429 | */ |
Kojto | 116:c0f6e94411f5 | 430 | #define __HAL_LPTIM_COMPARE_SET(__HANDLE__ , __VALUE__) ((__HANDLE__)->Instance->CMP = (__VALUE__)) |
Kojto | 116:c0f6e94411f5 | 431 | |
Kojto | 116:c0f6e94411f5 | 432 | /** |
Kojto | 116:c0f6e94411f5 | 433 | * @brief Checks whether the specified LPTIM flag is set or not. |
Kojto | 116:c0f6e94411f5 | 434 | * @param __HANDLE__: LPTIM handle |
Kojto | 116:c0f6e94411f5 | 435 | * @param __FLAG__ : LPTIM flag to check |
Kojto | 116:c0f6e94411f5 | 436 | * This parameter can be a value of: |
Kojto | 116:c0f6e94411f5 | 437 | * @arg LPTIM_FLAG_DOWN : Counter direction change up Flag. |
Kojto | 116:c0f6e94411f5 | 438 | * @arg LPTIM_FLAG_UP : Counter direction change down to up Flag. |
Kojto | 116:c0f6e94411f5 | 439 | * @arg LPTIM_FLAG_ARROK : Autoreload register update OK Flag. |
Kojto | 116:c0f6e94411f5 | 440 | * @arg LPTIM_FLAG_CMPOK : Compare register update OK Flag. |
Kojto | 116:c0f6e94411f5 | 441 | * @arg LPTIM_FLAG_EXTTRIG : External trigger edge event Flag. |
Kojto | 116:c0f6e94411f5 | 442 | * @arg LPTIM_FLAG_ARRM : Autoreload match Flag. |
Kojto | 116:c0f6e94411f5 | 443 | * @arg LPTIM_FLAG_CMPM : Compare match Flag. |
Kojto | 116:c0f6e94411f5 | 444 | * @retval The state of the specified flag (SET or RESET). |
Kojto | 116:c0f6e94411f5 | 445 | */ |
Kojto | 116:c0f6e94411f5 | 446 | #define __HAL_LPTIM_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR &(__FLAG__)) == (__FLAG__)) |
Kojto | 116:c0f6e94411f5 | 447 | |
Kojto | 116:c0f6e94411f5 | 448 | /** |
Kojto | 116:c0f6e94411f5 | 449 | * @brief Clears the specified LPTIM flag. |
Kojto | 116:c0f6e94411f5 | 450 | * @param __HANDLE__: LPTIM handle. |
Kojto | 116:c0f6e94411f5 | 451 | * @param __FLAG__ : LPTIM flag to clear. |
Kojto | 116:c0f6e94411f5 | 452 | * This parameter can be a value of: |
Kojto | 116:c0f6e94411f5 | 453 | * @arg LPTIM_FLAG_DOWN : Counter direction change up Flag. |
Kojto | 116:c0f6e94411f5 | 454 | * @arg LPTIM_FLAG_UP : Counter direction change down to up Flag. |
Kojto | 116:c0f6e94411f5 | 455 | * @arg LPTIM_FLAG_ARROK : Autoreload register update OK Flag. |
Kojto | 116:c0f6e94411f5 | 456 | * @arg LPTIM_FLAG_CMPOK : Compare register update OK Flag. |
Kojto | 116:c0f6e94411f5 | 457 | * @arg LPTIM_FLAG_EXTTRIG : External trigger edge event Flag. |
Kojto | 116:c0f6e94411f5 | 458 | * @arg LPTIM_FLAG_ARRM : Autoreload match Flag. |
Kojto | 116:c0f6e94411f5 | 459 | * @arg LPTIM_FLAG_CMPM : Compare match Flag. |
Kojto | 116:c0f6e94411f5 | 460 | * @retval None. |
Kojto | 116:c0f6e94411f5 | 461 | */ |
Kojto | 116:c0f6e94411f5 | 462 | #define __HAL_LPTIM_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__)) |
Kojto | 116:c0f6e94411f5 | 463 | |
Kojto | 116:c0f6e94411f5 | 464 | /** |
Kojto | 116:c0f6e94411f5 | 465 | * @brief Enable the specified LPTIM interrupt. |
Kojto | 116:c0f6e94411f5 | 466 | * @param __HANDLE__ : LPTIM handle. |
Kojto | 116:c0f6e94411f5 | 467 | * @param __INTERRUPT__ : LPTIM interrupt to set. |
Kojto | 116:c0f6e94411f5 | 468 | * This parameter can be a value of: |
Kojto | 116:c0f6e94411f5 | 469 | * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt. |
Kojto | 116:c0f6e94411f5 | 470 | * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt. |
Kojto | 116:c0f6e94411f5 | 471 | * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt. |
Kojto | 116:c0f6e94411f5 | 472 | * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt. |
Kojto | 116:c0f6e94411f5 | 473 | * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt. |
Kojto | 116:c0f6e94411f5 | 474 | * @arg LPTIM_IT_ARRM : Autoreload match Interrupt. |
Kojto | 116:c0f6e94411f5 | 475 | * @arg LPTIM_IT_CMPM : Compare match Interrupt. |
Kojto | 116:c0f6e94411f5 | 476 | * @retval None. |
Kojto | 116:c0f6e94411f5 | 477 | */ |
Kojto | 116:c0f6e94411f5 | 478 | #define __HAL_LPTIM_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__)) |
Kojto | 116:c0f6e94411f5 | 479 | |
Kojto | 116:c0f6e94411f5 | 480 | /** |
Kojto | 116:c0f6e94411f5 | 481 | * @brief Disable the specified LPTIM interrupt. |
Kojto | 116:c0f6e94411f5 | 482 | * @param __HANDLE__ : LPTIM handle. |
Kojto | 116:c0f6e94411f5 | 483 | * @param __INTERRUPT__ : LPTIM interrupt to set. |
Kojto | 116:c0f6e94411f5 | 484 | * This parameter can be a value of: |
Kojto | 116:c0f6e94411f5 | 485 | * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt. |
Kojto | 116:c0f6e94411f5 | 486 | * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt. |
Kojto | 116:c0f6e94411f5 | 487 | * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt. |
Kojto | 116:c0f6e94411f5 | 488 | * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt. |
Kojto | 116:c0f6e94411f5 | 489 | * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt. |
Kojto | 116:c0f6e94411f5 | 490 | * @arg LPTIM_IT_ARRM : Autoreload match Interrupt. |
Kojto | 116:c0f6e94411f5 | 491 | * @arg LPTIM_IT_CMPM : Compare match Interrupt. |
Kojto | 116:c0f6e94411f5 | 492 | * @retval None. |
Kojto | 116:c0f6e94411f5 | 493 | */ |
Kojto | 116:c0f6e94411f5 | 494 | #define __HAL_LPTIM_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= (~(__INTERRUPT__))) |
Kojto | 116:c0f6e94411f5 | 495 | |
Kojto | 116:c0f6e94411f5 | 496 | /** |
Kojto | 116:c0f6e94411f5 | 497 | * @brief Checks whether the specified LPTIM interrupt is set or not. |
Kojto | 116:c0f6e94411f5 | 498 | * @param __HANDLE__ : LPTIM handle. |
Kojto | 116:c0f6e94411f5 | 499 | * @param __INTERRUPT__ : LPTIM interrupt to check. |
Kojto | 116:c0f6e94411f5 | 500 | * This parameter can be a value of: |
Kojto | 116:c0f6e94411f5 | 501 | * @arg LPTIM_IT_DOWN : Counter direction change up Interrupt. |
Kojto | 116:c0f6e94411f5 | 502 | * @arg LPTIM_IT_UP : Counter direction change down to up Interrupt. |
Kojto | 116:c0f6e94411f5 | 503 | * @arg LPTIM_IT_ARROK : Autoreload register update OK Interrupt. |
Kojto | 116:c0f6e94411f5 | 504 | * @arg LPTIM_IT_CMPOK : Compare register update OK Interrupt. |
Kojto | 116:c0f6e94411f5 | 505 | * @arg LPTIM_IT_EXTTRIG : External trigger edge event Interrupt. |
Kojto | 116:c0f6e94411f5 | 506 | * @arg LPTIM_IT_ARRM : Autoreload match Interrupt. |
Kojto | 116:c0f6e94411f5 | 507 | * @arg LPTIM_IT_CMPM : Compare match Interrupt. |
Kojto | 116:c0f6e94411f5 | 508 | * @retval Interrupt status. |
Kojto | 116:c0f6e94411f5 | 509 | */ |
Kojto | 116:c0f6e94411f5 | 510 | |
Kojto | 116:c0f6e94411f5 | 511 | #define __HAL_LPTIM_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->IER & (__INTERRUPT__)) == (__INTERRUPT__)) ? SET : RESET) |
Kojto | 116:c0f6e94411f5 | 512 | |
Kojto | 116:c0f6e94411f5 | 513 | /** |
Kojto | 116:c0f6e94411f5 | 514 | * @} |
Kojto | 116:c0f6e94411f5 | 515 | */ |
Kojto | 116:c0f6e94411f5 | 516 | |
Kojto | 116:c0f6e94411f5 | 517 | |
Kojto | 116:c0f6e94411f5 | 518 | /* Include LPTIM HAL Extension module */ |
Kojto | 116:c0f6e94411f5 | 519 | #include "stm32l0xx_hal_lptim_ex.h" |
Kojto | 116:c0f6e94411f5 | 520 | |
Kojto | 116:c0f6e94411f5 | 521 | /* Exported functions --------------------------------------------------------*/ |
Kojto | 116:c0f6e94411f5 | 522 | |
Kojto | 116:c0f6e94411f5 | 523 | /** @defgroup LPTIM_Exported_Functions LPTIM Exported Functions |
Kojto | 116:c0f6e94411f5 | 524 | * @{ |
Kojto | 116:c0f6e94411f5 | 525 | */ |
Kojto | 116:c0f6e94411f5 | 526 | /* Initialization/de-initialization functions ********************************/ |
Kojto | 116:c0f6e94411f5 | 527 | |
Kojto | 116:c0f6e94411f5 | 528 | /** @defgroup LPTIM_Exported_Functions_Group1 Initialization/de-initialization functions |
Kojto | 116:c0f6e94411f5 | 529 | * @{ |
Kojto | 116:c0f6e94411f5 | 530 | */ |
Kojto | 116:c0f6e94411f5 | 531 | HAL_StatusTypeDef HAL_LPTIM_Init(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 532 | HAL_StatusTypeDef HAL_LPTIM_DeInit(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 533 | |
Kojto | 116:c0f6e94411f5 | 534 | |
Kojto | 116:c0f6e94411f5 | 535 | /* MSP functions *************************************************************/ |
Kojto | 116:c0f6e94411f5 | 536 | |
Kojto | 116:c0f6e94411f5 | 537 | void HAL_LPTIM_MspInit(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 538 | void HAL_LPTIM_MspDeInit(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 539 | |
Kojto | 116:c0f6e94411f5 | 540 | /** |
Kojto | 116:c0f6e94411f5 | 541 | * @} |
Kojto | 116:c0f6e94411f5 | 542 | */ |
Kojto | 116:c0f6e94411f5 | 543 | |
Kojto | 116:c0f6e94411f5 | 544 | /* Start/Stop operation functions *********************************************/ |
Kojto | 116:c0f6e94411f5 | 545 | |
Kojto | 116:c0f6e94411f5 | 546 | /** @defgroup LPTIM_Exported_Functions_Group2 LPTIM Start-Stop operation functions |
Kojto | 116:c0f6e94411f5 | 547 | * @{ |
Kojto | 116:c0f6e94411f5 | 548 | */ |
Kojto | 116:c0f6e94411f5 | 549 | |
Kojto | 116:c0f6e94411f5 | 550 | /* ################################# PWM Mode ################################*/ |
Kojto | 116:c0f6e94411f5 | 551 | /* Blocking mode: Polling */ |
Kojto | 116:c0f6e94411f5 | 552 | HAL_StatusTypeDef HAL_LPTIM_PWM_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); |
Kojto | 116:c0f6e94411f5 | 553 | HAL_StatusTypeDef HAL_LPTIM_PWM_Stop(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 554 | /* Non-Blocking mode: Interrupt */ |
Kojto | 116:c0f6e94411f5 | 555 | HAL_StatusTypeDef HAL_LPTIM_PWM_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); |
Kojto | 116:c0f6e94411f5 | 556 | HAL_StatusTypeDef HAL_LPTIM_PWM_Stop_IT(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 557 | |
Kojto | 116:c0f6e94411f5 | 558 | /* ############################# One Pulse Mode ##############################*/ |
Kojto | 116:c0f6e94411f5 | 559 | /* Blocking mode: Polling */ |
Kojto | 116:c0f6e94411f5 | 560 | HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); |
Kojto | 116:c0f6e94411f5 | 561 | HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 562 | /* Non-Blocking mode: Interrupt */ |
Kojto | 116:c0f6e94411f5 | 563 | HAL_StatusTypeDef HAL_LPTIM_OnePulse_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); |
Kojto | 116:c0f6e94411f5 | 564 | HAL_StatusTypeDef HAL_LPTIM_OnePulse_Stop_IT(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 565 | |
Kojto | 116:c0f6e94411f5 | 566 | /* ############################## Set once Mode ##############################*/ |
Kojto | 116:c0f6e94411f5 | 567 | /* Blocking mode: Polling */ |
Kojto | 116:c0f6e94411f5 | 568 | HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); |
Kojto | 116:c0f6e94411f5 | 569 | HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 570 | /* Non-Blocking mode: Interrupt */ |
Kojto | 116:c0f6e94411f5 | 571 | HAL_StatusTypeDef HAL_LPTIM_SetOnce_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Pulse); |
Kojto | 116:c0f6e94411f5 | 572 | HAL_StatusTypeDef HAL_LPTIM_SetOnce_Stop_IT(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 573 | |
Kojto | 116:c0f6e94411f5 | 574 | /* ############################### Encoder Mode ##############################*/ |
Kojto | 116:c0f6e94411f5 | 575 | /* Blocking mode: Polling */ |
Kojto | 116:c0f6e94411f5 | 576 | HAL_StatusTypeDef HAL_LPTIM_Encoder_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period); |
Kojto | 116:c0f6e94411f5 | 577 | HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 578 | /* Non-Blocking mode: Interrupt */ |
Kojto | 116:c0f6e94411f5 | 579 | HAL_StatusTypeDef HAL_LPTIM_Encoder_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period); |
Kojto | 116:c0f6e94411f5 | 580 | HAL_StatusTypeDef HAL_LPTIM_Encoder_Stop_IT(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 581 | |
Kojto | 116:c0f6e94411f5 | 582 | /* ############################# Time out Mode ##############################*/ |
Kojto | 116:c0f6e94411f5 | 583 | /* Blocking mode: Polling */ |
Kojto | 116:c0f6e94411f5 | 584 | HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout); |
Kojto | 116:c0f6e94411f5 | 585 | HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 586 | /* Non-Blocking mode: Interrupt */ |
Kojto | 116:c0f6e94411f5 | 587 | HAL_StatusTypeDef HAL_LPTIM_TimeOut_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period, uint32_t Timeout); |
Kojto | 116:c0f6e94411f5 | 588 | HAL_StatusTypeDef HAL_LPTIM_TimeOut_Stop_IT(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 589 | |
Kojto | 116:c0f6e94411f5 | 590 | /* ############################## Counter Mode ###############################*/ |
Kojto | 116:c0f6e94411f5 | 591 | /* Blocking mode: Polling */ |
Kojto | 116:c0f6e94411f5 | 592 | HAL_StatusTypeDef HAL_LPTIM_Counter_Start(LPTIM_HandleTypeDef *hlptim, uint32_t Period); |
Kojto | 116:c0f6e94411f5 | 593 | HAL_StatusTypeDef HAL_LPTIM_Counter_Stop(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 594 | /* Non-Blocking mode: Interrupt */ |
Kojto | 116:c0f6e94411f5 | 595 | HAL_StatusTypeDef HAL_LPTIM_Counter_Start_IT(LPTIM_HandleTypeDef *hlptim, uint32_t Period); |
Kojto | 116:c0f6e94411f5 | 596 | HAL_StatusTypeDef HAL_LPTIM_Counter_Stop_IT(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 597 | |
Kojto | 116:c0f6e94411f5 | 598 | /** |
Kojto | 116:c0f6e94411f5 | 599 | * @} |
Kojto | 116:c0f6e94411f5 | 600 | */ |
Kojto | 116:c0f6e94411f5 | 601 | |
Kojto | 116:c0f6e94411f5 | 602 | /* Reading operation functions ************************************************/ |
Kojto | 116:c0f6e94411f5 | 603 | |
Kojto | 116:c0f6e94411f5 | 604 | /** @defgroup LPTIM_Exported_Functions_Group3 LPTIM Read operation functions |
Kojto | 116:c0f6e94411f5 | 605 | * @{ |
Kojto | 116:c0f6e94411f5 | 606 | */ |
Kojto | 116:c0f6e94411f5 | 607 | uint32_t HAL_LPTIM_ReadCounter(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 608 | uint32_t HAL_LPTIM_ReadAutoReload(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 609 | uint32_t HAL_LPTIM_ReadCompare(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 610 | /** |
Kojto | 116:c0f6e94411f5 | 611 | * @} |
Kojto | 116:c0f6e94411f5 | 612 | */ |
Kojto | 116:c0f6e94411f5 | 613 | |
Kojto | 116:c0f6e94411f5 | 614 | /* LPTIM IRQ functions *******************************************************/ |
Kojto | 116:c0f6e94411f5 | 615 | /** @defgroup LPTIM_Exported_Functions_Group4 LPTIM IRQ handler |
Kojto | 116:c0f6e94411f5 | 616 | * @{ |
Kojto | 116:c0f6e94411f5 | 617 | */ |
Kojto | 116:c0f6e94411f5 | 618 | void HAL_LPTIM_IRQHandler(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 619 | |
Kojto | 116:c0f6e94411f5 | 620 | /* CallBack functions ********************************************************/ |
Kojto | 116:c0f6e94411f5 | 621 | void HAL_LPTIM_CompareMatchCallback(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 622 | void HAL_LPTIM_AutoReloadMatchCallback(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 623 | void HAL_LPTIM_TriggerCallback(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 624 | void HAL_LPTIM_CompareWriteCallback(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 625 | void HAL_LPTIM_AutoReloadWriteCallback(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 626 | void HAL_LPTIM_DirectionUpCallback(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 627 | void HAL_LPTIM_DirectionDownCallback(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 628 | /** |
Kojto | 116:c0f6e94411f5 | 629 | * @} |
Kojto | 116:c0f6e94411f5 | 630 | */ |
Kojto | 116:c0f6e94411f5 | 631 | /* Peripheral State functions ************************************************/ |
Kojto | 116:c0f6e94411f5 | 632 | /** @defgroup LPTIM_Exported_Functions_Group5 Peripheral State functions |
Kojto | 116:c0f6e94411f5 | 633 | * @{ |
Kojto | 116:c0f6e94411f5 | 634 | */ |
Kojto | 116:c0f6e94411f5 | 635 | |
Kojto | 116:c0f6e94411f5 | 636 | HAL_LPTIM_StateTypeDef HAL_LPTIM_GetState(LPTIM_HandleTypeDef *hlptim); |
Kojto | 116:c0f6e94411f5 | 637 | |
Kojto | 116:c0f6e94411f5 | 638 | /** |
Kojto | 116:c0f6e94411f5 | 639 | * @} |
Kojto | 116:c0f6e94411f5 | 640 | */ |
Kojto | 116:c0f6e94411f5 | 641 | |
Kojto | 116:c0f6e94411f5 | 642 | /** |
Kojto | 116:c0f6e94411f5 | 643 | * @} |
Kojto | 116:c0f6e94411f5 | 644 | */ |
Kojto | 116:c0f6e94411f5 | 645 | |
Kojto | 116:c0f6e94411f5 | 646 | /** |
Kojto | 116:c0f6e94411f5 | 647 | * @} |
Kojto | 116:c0f6e94411f5 | 648 | */ |
Kojto | 116:c0f6e94411f5 | 649 | |
Kojto | 116:c0f6e94411f5 | 650 | /** |
Kojto | 116:c0f6e94411f5 | 651 | * @} |
Kojto | 116:c0f6e94411f5 | 652 | */ |
Kojto | 116:c0f6e94411f5 | 653 | |
Kojto | 116:c0f6e94411f5 | 654 | #ifdef __cplusplus |
Kojto | 116:c0f6e94411f5 | 655 | } |
Kojto | 116:c0f6e94411f5 | 656 | #endif |
Kojto | 116:c0f6e94411f5 | 657 | |
Kojto | 116:c0f6e94411f5 | 658 | #endif /* __STM32L0xx_HAL_LPTIM_H */ |
Kojto | 116:c0f6e94411f5 | 659 | |
Kojto | 116:c0f6e94411f5 | 660 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
Kojto | 116:c0f6e94411f5 | 661 |