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