stm32l4xx.h 8.5 KB

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