Christos Vasilakis
/
pelion-example-common-DISCO_F413ZH
pelion-example-common-DISCO_F413ZH
targets/TARGET_STM32L475xG_SRAM2/device/stm32l4xx.h@28:f3b254af78b2, 2020-01-27 (annotated)
- Committer:
- cvasilak
- Date:
- Mon Jan 27 16:29:54 2020 +0000
- Revision:
- 28:f3b254af78b2
- Parent:
- 23:64f3f756acf6
blinking pattern refactoring
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
screamer | 23:64f3f756acf6 | 1 | /** |
screamer | 23:64f3f756acf6 | 2 | ****************************************************************************** |
screamer | 23:64f3f756acf6 | 3 | * @file stm32l4xx.h |
screamer | 23:64f3f756acf6 | 4 | * @author MCD Application Team |
screamer | 23:64f3f756acf6 | 5 | * @brief CMSIS STM32L4xx Device Peripheral Access Layer Header File. |
screamer | 23:64f3f756acf6 | 6 | * |
screamer | 23:64f3f756acf6 | 7 | * The file is the unique include file that the application programmer |
screamer | 23:64f3f756acf6 | 8 | * is using in the C source code, usually in main.c. This file contains: |
screamer | 23:64f3f756acf6 | 9 | * - Configuration section that allows to select: |
screamer | 23:64f3f756acf6 | 10 | * - The STM32L4xx device used in the target application |
screamer | 23:64f3f756acf6 | 11 | * - To use or not the peripherals drivers in application code(i.e. |
screamer | 23:64f3f756acf6 | 12 | * code will be based on direct access to peripherals registers |
screamer | 23:64f3f756acf6 | 13 | * rather than drivers API), this option is controlled by |
screamer | 23:64f3f756acf6 | 14 | * "#define USE_HAL_DRIVER" |
screamer | 23:64f3f756acf6 | 15 | * |
screamer | 23:64f3f756acf6 | 16 | ****************************************************************************** |
screamer | 23:64f3f756acf6 | 17 | * @attention |
screamer | 23:64f3f756acf6 | 18 | * |
screamer | 23:64f3f756acf6 | 19 | * <h2><center>© COPYRIGHT(c) 2017 STMicroelectronics</center></h2> |
screamer | 23:64f3f756acf6 | 20 | * |
screamer | 23:64f3f756acf6 | 21 | * Redistribution and use in source and binary forms, with or without modification, |
screamer | 23:64f3f756acf6 | 22 | * are permitted provided that the following conditions are met: |
screamer | 23:64f3f756acf6 | 23 | * 1. Redistributions of source code must retain the above copyright notice, |
screamer | 23:64f3f756acf6 | 24 | * this list of conditions and the following disclaimer. |
screamer | 23:64f3f756acf6 | 25 | * 2. Redistributions in binary form must reproduce the above copyright notice, |
screamer | 23:64f3f756acf6 | 26 | * this list of conditions and the following disclaimer in the documentation |
screamer | 23:64f3f756acf6 | 27 | * and/or other materials provided with the distribution. |
screamer | 23:64f3f756acf6 | 28 | * 3. Neither the name of STMicroelectronics nor the names of its contributors |
screamer | 23:64f3f756acf6 | 29 | * may be used to endorse or promote products derived from this software |
screamer | 23:64f3f756acf6 | 30 | * without specific prior written permission. |
screamer | 23:64f3f756acf6 | 31 | * |
screamer | 23:64f3f756acf6 | 32 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
screamer | 23:64f3f756acf6 | 33 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
screamer | 23:64f3f756acf6 | 34 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
screamer | 23:64f3f756acf6 | 35 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE |
screamer | 23:64f3f756acf6 | 36 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
screamer | 23:64f3f756acf6 | 37 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
screamer | 23:64f3f756acf6 | 38 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
screamer | 23:64f3f756acf6 | 39 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
screamer | 23:64f3f756acf6 | 40 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
screamer | 23:64f3f756acf6 | 41 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
screamer | 23:64f3f756acf6 | 42 | * |
screamer | 23:64f3f756acf6 | 43 | ****************************************************************************** |
screamer | 23:64f3f756acf6 | 44 | */ |
screamer | 23:64f3f756acf6 | 45 | |
screamer | 23:64f3f756acf6 | 46 | /** @addtogroup CMSIS |
screamer | 23:64f3f756acf6 | 47 | * @{ |
screamer | 23:64f3f756acf6 | 48 | */ |
screamer | 23:64f3f756acf6 | 49 | |
screamer | 23:64f3f756acf6 | 50 | /** @addtogroup stm32l4xx |
screamer | 23:64f3f756acf6 | 51 | * @{ |
screamer | 23:64f3f756acf6 | 52 | */ |
screamer | 23:64f3f756acf6 | 53 | |
screamer | 23:64f3f756acf6 | 54 | #ifndef __STM32L4xx_H |
screamer | 23:64f3f756acf6 | 55 | #define __STM32L4xx_H |
screamer | 23:64f3f756acf6 | 56 | |
screamer | 23:64f3f756acf6 | 57 | #ifdef __cplusplus |
screamer | 23:64f3f756acf6 | 58 | extern "C" { |
screamer | 23:64f3f756acf6 | 59 | #endif /* __cplusplus */ |
screamer | 23:64f3f756acf6 | 60 | |
screamer | 23:64f3f756acf6 | 61 | /** @addtogroup Library_configuration_section |
screamer | 23:64f3f756acf6 | 62 | * @{ |
screamer | 23:64f3f756acf6 | 63 | */ |
screamer | 23:64f3f756acf6 | 64 | |
screamer | 23:64f3f756acf6 | 65 | /** |
screamer | 23:64f3f756acf6 | 66 | * @brief STM32 Family |
screamer | 23:64f3f756acf6 | 67 | */ |
screamer | 23:64f3f756acf6 | 68 | #if !defined (STM32L4) |
screamer | 23:64f3f756acf6 | 69 | #define STM32L4 |
screamer | 23:64f3f756acf6 | 70 | #endif /* STM32L4 */ |
screamer | 23:64f3f756acf6 | 71 | |
screamer | 23:64f3f756acf6 | 72 | /* Uncomment the line below according to the target STM32L4 device used in your |
screamer | 23:64f3f756acf6 | 73 | application |
screamer | 23:64f3f756acf6 | 74 | */ |
screamer | 23:64f3f756acf6 | 75 | |
screamer | 23:64f3f756acf6 | 76 | #if !defined (STM32L431xx) && !defined (STM32L432xx) && !defined (STM32L433xx) && !defined (STM32L442xx) && !defined (STM32L443xx) && \ |
screamer | 23:64f3f756acf6 | 77 | !defined (STM32L451xx) && !defined (STM32L452xx) && !defined (STM32L462xx) && \ |
screamer | 23:64f3f756acf6 | 78 | !defined (STM32L471xx) && !defined (STM32L475xx) && !defined (STM32L476xx) && !defined (STM32L485xx) && !defined (STM32L486xx) && \ |
screamer | 23:64f3f756acf6 | 79 | !defined (STM32L496xx) && !defined (STM32L4A6xx) && \ |
screamer | 23:64f3f756acf6 | 80 | !defined (STM32L4R5xx) && !defined (STM32L4R7xx) && !defined (STM32L4R9xx) && !defined (STM32L4S5xx) && !defined (STM32L4S7xx) && !defined (STM32L4S9xx) |
screamer | 23:64f3f756acf6 | 81 | /* #define STM32L431xx */ /*!< STM32L431xx Devices */ |
screamer | 23:64f3f756acf6 | 82 | /* #define STM32L432xx */ /*!< STM32L432xx Devices */ |
screamer | 23:64f3f756acf6 | 83 | /* #define STM32L433xx */ /*!< STM32L433xx Devices */ |
screamer | 23:64f3f756acf6 | 84 | /* #define STM32L442xx */ /*!< STM32L442xx Devices */ |
screamer | 23:64f3f756acf6 | 85 | /* #define STM32L443xx */ /*!< STM32L443xx Devices */ |
screamer | 23:64f3f756acf6 | 86 | /* #define STM32L451xx */ /*!< STM32L451xx Devices */ |
screamer | 23:64f3f756acf6 | 87 | /* #define STM32L452xx */ /*!< STM32L452xx Devices */ |
screamer | 23:64f3f756acf6 | 88 | /* #define STM32L462xx */ /*!< STM32L462xx Devices */ |
screamer | 23:64f3f756acf6 | 89 | /* #define STM32L471xx */ /*!< STM32L471xx Devices */ |
screamer | 23:64f3f756acf6 | 90 | #define STM32L475xx /*!< STM32L475xx Devices */ |
screamer | 23:64f3f756acf6 | 91 | /* #define STM32L476xx */ /*!< STM32L476xx Devices */ |
screamer | 23:64f3f756acf6 | 92 | /* #define STM32L485xx */ /*!< STM32L485xx Devices */ |
screamer | 23:64f3f756acf6 | 93 | /* #define STM32L486xx */ /*!< STM32L486xx Devices */ |
screamer | 23:64f3f756acf6 | 94 | /* #define STM32L496xx */ /*!< STM32L496xx Devices */ |
screamer | 23:64f3f756acf6 | 95 | /* #define STM32L4A6xx */ /*!< STM32L4A6xx Devices */ |
screamer | 23:64f3f756acf6 | 96 | /* #define STM32L4R5xx */ /*!< STM32L4R5xx Devices */ |
screamer | 23:64f3f756acf6 | 97 | /* #define STM32L4R7xx */ /*!< STM32L4R7xx Devices */ |
screamer | 23:64f3f756acf6 | 98 | /* #define STM32L4R9xx */ /*!< STM32L4R9xx Devices */ |
screamer | 23:64f3f756acf6 | 99 | /* #define STM32L4S5xx */ /*!< STM32L4S5xx Devices */ |
screamer | 23:64f3f756acf6 | 100 | /* #define STM32L4S7xx */ /*!< STM32L4S7xx Devices */ |
screamer | 23:64f3f756acf6 | 101 | /* #define STM32L4S9xx */ /*!< STM32L4S9xx Devices */ |
screamer | 23:64f3f756acf6 | 102 | #endif |
screamer | 23:64f3f756acf6 | 103 | |
screamer | 23:64f3f756acf6 | 104 | /* Tip: To avoid modifying this file each time you need to switch between these |
screamer | 23:64f3f756acf6 | 105 | devices, you can define the device in your toolchain compiler preprocessor. |
screamer | 23:64f3f756acf6 | 106 | */ |
screamer | 23:64f3f756acf6 | 107 | #if !defined (USE_HAL_DRIVER) |
screamer | 23:64f3f756acf6 | 108 | /** |
screamer | 23:64f3f756acf6 | 109 | * @brief Comment the line below if you will not use the peripherals drivers. |
screamer | 23:64f3f756acf6 | 110 | In this case, these drivers will not be included and the application code will |
screamer | 23:64f3f756acf6 | 111 | be based on direct access to peripherals registers |
screamer | 23:64f3f756acf6 | 112 | */ |
screamer | 23:64f3f756acf6 | 113 | #define USE_HAL_DRIVER |
screamer | 23:64f3f756acf6 | 114 | #endif /* USE_HAL_DRIVER */ |
screamer | 23:64f3f756acf6 | 115 | |
screamer | 23:64f3f756acf6 | 116 | /** |
screamer | 23:64f3f756acf6 | 117 | * @brief CMSIS Device version number |
screamer | 23:64f3f756acf6 | 118 | */ |
screamer | 23:64f3f756acf6 | 119 | #define __STM32L4_CMSIS_VERSION_MAIN (0x01) /*!< [31:24] main version */ |
screamer | 23:64f3f756acf6 | 120 | #define __STM32L4_CMSIS_VERSION_SUB1 (0x04) /*!< [23:16] sub1 version */ |
screamer | 23:64f3f756acf6 | 121 | #define __STM32L4_CMSIS_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */ |
screamer | 23:64f3f756acf6 | 122 | #define __STM32L4_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */ |
screamer | 23:64f3f756acf6 | 123 | #define __STM32L4_CMSIS_VERSION ((__STM32L4_CMSIS_VERSION_MAIN << 24)\ |
screamer | 23:64f3f756acf6 | 124 | |(__STM32L4_CMSIS_VERSION_SUB1 << 16)\ |
screamer | 23:64f3f756acf6 | 125 | |(__STM32L4_CMSIS_VERSION_SUB2 << 8 )\ |
screamer | 23:64f3f756acf6 | 126 | |(__STM32L4_CMSIS_VERSION_RC)) |
screamer | 23:64f3f756acf6 | 127 | |
screamer | 23:64f3f756acf6 | 128 | /** |
screamer | 23:64f3f756acf6 | 129 | * @} |
screamer | 23:64f3f756acf6 | 130 | */ |
screamer | 23:64f3f756acf6 | 131 | |
screamer | 23:64f3f756acf6 | 132 | /** @addtogroup Device_Included |
screamer | 23:64f3f756acf6 | 133 | * @{ |
screamer | 23:64f3f756acf6 | 134 | */ |
screamer | 23:64f3f756acf6 | 135 | |
screamer | 23:64f3f756acf6 | 136 | #if defined(STM32L431xx) |
screamer | 23:64f3f756acf6 | 137 | #include "stm32l431xx.h" |
screamer | 23:64f3f756acf6 | 138 | #elif defined(STM32L432xx) |
screamer | 23:64f3f756acf6 | 139 | #include "stm32l432xx.h" |
screamer | 23:64f3f756acf6 | 140 | #elif defined(STM32L433xx) |
screamer | 23:64f3f756acf6 | 141 | #include "stm32l433xx.h" |
screamer | 23:64f3f756acf6 | 142 | #elif defined(STM32L442xx) |
screamer | 23:64f3f756acf6 | 143 | #include "stm32l442xx.h" |
screamer | 23:64f3f756acf6 | 144 | #elif defined(STM32L443xx) |
screamer | 23:64f3f756acf6 | 145 | #include "stm32l443xx.h" |
screamer | 23:64f3f756acf6 | 146 | #elif defined(STM32L451xx) |
screamer | 23:64f3f756acf6 | 147 | #include "stm32l451xx.h" |
screamer | 23:64f3f756acf6 | 148 | #elif defined(STM32L452xx) |
screamer | 23:64f3f756acf6 | 149 | #include "stm32l452xx.h" |
screamer | 23:64f3f756acf6 | 150 | #elif defined(STM32L462xx) |
screamer | 23:64f3f756acf6 | 151 | #include "stm32l462xx.h" |
screamer | 23:64f3f756acf6 | 152 | #elif defined(STM32L471xx) |
screamer | 23:64f3f756acf6 | 153 | #include "stm32l471xx.h" |
screamer | 23:64f3f756acf6 | 154 | #elif defined(STM32L475xx) |
screamer | 23:64f3f756acf6 | 155 | #include "stm32l475xx.h" |
screamer | 23:64f3f756acf6 | 156 | #elif defined(STM32L476xx) |
screamer | 23:64f3f756acf6 | 157 | #include "stm32l476xx.h" |
screamer | 23:64f3f756acf6 | 158 | #elif defined(STM32L485xx) |
screamer | 23:64f3f756acf6 | 159 | #include "stm32l485xx.h" |
screamer | 23:64f3f756acf6 | 160 | #elif defined(STM32L486xx) |
screamer | 23:64f3f756acf6 | 161 | #include "stm32l486xx.h" |
screamer | 23:64f3f756acf6 | 162 | #elif defined(STM32L496xx) |
screamer | 23:64f3f756acf6 | 163 | #include "stm32l496xx.h" |
screamer | 23:64f3f756acf6 | 164 | #elif defined(STM32L4A6xx) |
screamer | 23:64f3f756acf6 | 165 | #include "stm32l4a6xx.h" |
screamer | 23:64f3f756acf6 | 166 | #elif defined(STM32L4R5xx) |
screamer | 23:64f3f756acf6 | 167 | #include "stm32l4r5xx.h" |
screamer | 23:64f3f756acf6 | 168 | #elif defined(STM32L4R7xx) |
screamer | 23:64f3f756acf6 | 169 | #include "stm32l4r7xx.h" |
screamer | 23:64f3f756acf6 | 170 | #elif defined(STM32L4R9xx) |
screamer | 23:64f3f756acf6 | 171 | #include "stm32l4r9xx.h" |
screamer | 23:64f3f756acf6 | 172 | #elif defined(STM32L4S5xx) |
screamer | 23:64f3f756acf6 | 173 | #include "stm32l4s5xx.h" |
screamer | 23:64f3f756acf6 | 174 | #elif defined(STM32L4S7xx) |
screamer | 23:64f3f756acf6 | 175 | #include "stm32l4s7xx.h" |
screamer | 23:64f3f756acf6 | 176 | #elif defined(STM32L4S9xx) |
screamer | 23:64f3f756acf6 | 177 | #include "stm32l4s9xx.h" |
screamer | 23:64f3f756acf6 | 178 | #else |
screamer | 23:64f3f756acf6 | 179 | #error "Please select first the target STM32L4xx device used in your application (in stm32l4xx.h file)" |
screamer | 23:64f3f756acf6 | 180 | #endif |
screamer | 23:64f3f756acf6 | 181 | |
screamer | 23:64f3f756acf6 | 182 | /** |
screamer | 23:64f3f756acf6 | 183 | * @} |
screamer | 23:64f3f756acf6 | 184 | */ |
screamer | 23:64f3f756acf6 | 185 | |
screamer | 23:64f3f756acf6 | 186 | /** @addtogroup Exported_types |
screamer | 23:64f3f756acf6 | 187 | * @{ |
screamer | 23:64f3f756acf6 | 188 | */ |
screamer | 23:64f3f756acf6 | 189 | typedef enum |
screamer | 23:64f3f756acf6 | 190 | { |
screamer | 23:64f3f756acf6 | 191 | RESET = 0, |
screamer | 23:64f3f756acf6 | 192 | SET = !RESET |
screamer | 23:64f3f756acf6 | 193 | } FlagStatus, ITStatus; |
screamer | 23:64f3f756acf6 | 194 | |
screamer | 23:64f3f756acf6 | 195 | typedef enum |
screamer | 23:64f3f756acf6 | 196 | { |
screamer | 23:64f3f756acf6 | 197 | DISABLE = 0, |
screamer | 23:64f3f756acf6 | 198 | ENABLE = !DISABLE |
screamer | 23:64f3f756acf6 | 199 | } FunctionalState; |
screamer | 23:64f3f756acf6 | 200 | #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) |
screamer | 23:64f3f756acf6 | 201 | |
screamer | 23:64f3f756acf6 | 202 | typedef enum |
screamer | 23:64f3f756acf6 | 203 | { |
screamer | 23:64f3f756acf6 | 204 | ERROR = 0, |
screamer | 23:64f3f756acf6 | 205 | SUCCESS = !ERROR |
screamer | 23:64f3f756acf6 | 206 | } ErrorStatus; |
screamer | 23:64f3f756acf6 | 207 | |
screamer | 23:64f3f756acf6 | 208 | /** |
screamer | 23:64f3f756acf6 | 209 | * @} |
screamer | 23:64f3f756acf6 | 210 | */ |
screamer | 23:64f3f756acf6 | 211 | |
screamer | 23:64f3f756acf6 | 212 | |
screamer | 23:64f3f756acf6 | 213 | /** @addtogroup Exported_macros |
screamer | 23:64f3f756acf6 | 214 | * @{ |
screamer | 23:64f3f756acf6 | 215 | */ |
screamer | 23:64f3f756acf6 | 216 | #define SET_BIT(REG, BIT) ((REG) |= (BIT)) |
screamer | 23:64f3f756acf6 | 217 | |
screamer | 23:64f3f756acf6 | 218 | #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) |
screamer | 23:64f3f756acf6 | 219 | |
screamer | 23:64f3f756acf6 | 220 | #define READ_BIT(REG, BIT) ((REG) & (BIT)) |
screamer | 23:64f3f756acf6 | 221 | |
screamer | 23:64f3f756acf6 | 222 | #define CLEAR_REG(REG) ((REG) = (0x0)) |
screamer | 23:64f3f756acf6 | 223 | |
screamer | 23:64f3f756acf6 | 224 | #define WRITE_REG(REG, VAL) ((REG) = (VAL)) |
screamer | 23:64f3f756acf6 | 225 | |
screamer | 23:64f3f756acf6 | 226 | #define READ_REG(REG) ((REG)) |
screamer | 23:64f3f756acf6 | 227 | |
screamer | 23:64f3f756acf6 | 228 | #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) |
screamer | 23:64f3f756acf6 | 229 | |
screamer | 23:64f3f756acf6 | 230 | #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) |
screamer | 23:64f3f756acf6 | 231 | |
screamer | 23:64f3f756acf6 | 232 | |
screamer | 23:64f3f756acf6 | 233 | /** |
screamer | 23:64f3f756acf6 | 234 | * @} |
screamer | 23:64f3f756acf6 | 235 | */ |
screamer | 23:64f3f756acf6 | 236 | |
screamer | 23:64f3f756acf6 | 237 | #if defined (USE_HAL_DRIVER) |
screamer | 23:64f3f756acf6 | 238 | #include "stm32l4xx_hal.h" |
screamer | 23:64f3f756acf6 | 239 | #endif /* USE_HAL_DRIVER */ |
screamer | 23:64f3f756acf6 | 240 | |
screamer | 23:64f3f756acf6 | 241 | #ifdef __cplusplus |
screamer | 23:64f3f756acf6 | 242 | } |
screamer | 23:64f3f756acf6 | 243 | #endif /* __cplusplus */ |
screamer | 23:64f3f756acf6 | 244 | |
screamer | 23:64f3f756acf6 | 245 | #endif /* __STM32L4xx_H */ |
screamer | 23:64f3f756acf6 | 246 | /** |
screamer | 23:64f3f756acf6 | 247 | * @} |
screamer | 23:64f3f756acf6 | 248 | */ |
screamer | 23:64f3f756acf6 | 249 | |
screamer | 23:64f3f756acf6 | 250 | /** |
screamer | 23:64f3f756acf6 | 251 | * @} |
screamer | 23:64f3f756acf6 | 252 | */ |
screamer | 23:64f3f756acf6 | 253 | |
screamer | 23:64f3f756acf6 | 254 | |
screamer | 23:64f3f756acf6 | 255 | |
screamer | 23:64f3f756acf6 | 256 | |
screamer | 23:64f3f756acf6 | 257 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |