stm32l4xx.h 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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 (STM32L431xx) && !defined (STM32L432xx) && !defined (STM32L433xx) && !defined (STM32L442xx) && !defined (STM32L443xx) && \
  69. !defined (STM32L451xx) && !defined (STM32L452xx) && !defined (STM32L462xx) && \
  70. !defined (STM32L471xx) && !defined (STM32L475xx) && !defined (STM32L476xx) && !defined (STM32L485xx) && !defined (STM32L486xx) && \
  71. !defined (STM32L496xx) && !defined (STM32L4A6xx) && \
  72. !defined (STM32L4R5xx) && !defined (STM32L4R7xx) && !defined (STM32L4R9xx) && !defined (STM32L4S5xx) && !defined (STM32L4S7xx) && !defined (STM32L4S9xx)
  73. /* #define STM32L431xx */ /*!< STM32L431xx Devices */
  74. #define STM32L432xx /*!< STM32L432xx Devices */
  75. /* #define STM32L433xx */ /*!< STM32L433xx Devices */
  76. /* #define STM32L442xx */ /*!< STM32L442xx Devices */
  77. /* #define STM32L443xx */ /*!< STM32L443xx Devices */
  78. /* #define STM32L451xx */ /*!< STM32L451xx Devices */
  79. /* #define STM32L452xx */ /*!< STM32L452xx Devices */
  80. /* #define STM32L462xx */ /*!< STM32L462xx Devices */
  81. /* #define STM32L471xx */ /*!< STM32L471xx Devices */
  82. /* #define STM32L475xx */ /*!< STM32L475xx Devices */
  83. /* #define STM32L476xx */ /*!< STM32L476xx Devices */
  84. /* #define STM32L485xx */ /*!< STM32L485xx Devices */
  85. /* #define STM32L486xx */ /*!< STM32L486xx Devices */
  86. /* #define STM32L496xx */ /*!< STM32L496xx Devices */
  87. /* #define STM32L4A6xx */ /*!< STM32L4A6xx Devices */
  88. /* #define STM32L4R5xx */ /*!< STM32L4R5xx Devices */
  89. /* #define STM32L4R7xx */ /*!< STM32L4R7xx Devices */
  90. /* #define STM32L4R9xx */ /*!< STM32L4R9xx Devices */
  91. /* #define STM32L4S5xx */ /*!< STM32L4S5xx Devices */
  92. /* #define STM32L4S7xx */ /*!< STM32L4S7xx Devices */
  93. /* #define STM32L4S9xx */ /*!< STM32L4S9xx Devices */
  94. #endif
  95. /* Tip: To avoid modifying this file each time you need to switch between these
  96. devices, you can define the device in your toolchain compiler preprocessor.
  97. */
  98. #if !defined (USE_HAL_DRIVER)
  99. /**
  100. * @brief Comment the line below if you will not use the peripherals drivers.
  101. In this case, these drivers will not be included and the application code will
  102. be based on direct access to peripherals registers
  103. */
  104. /*#define USE_HAL_DRIVER */
  105. #endif /* USE_HAL_DRIVER */
  106. /**
  107. * @brief CMSIS Device version number
  108. */
  109. #define __STM32L4_CMSIS_VERSION_MAIN (0x01) /*!< [31:24] main version */
  110. #define __STM32L4_CMSIS_VERSION_SUB1 (0x04) /*!< [23:16] sub1 version */
  111. #define __STM32L4_CMSIS_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */
  112. #define __STM32L4_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */
  113. #define __STM32L4_CMSIS_VERSION ((__STM32L4_CMSIS_VERSION_MAIN << 24)\
  114. |(__STM32L4_CMSIS_VERSION_SUB1 << 16)\
  115. |(__STM32L4_CMSIS_VERSION_SUB2 << 8 )\
  116. |(__STM32L4_CMSIS_VERSION_RC))
  117. /**
  118. * @}
  119. */
  120. /** @addtogroup Device_Included
  121. * @{
  122. */
  123. #if defined(STM32L431xx)
  124. #include "stm32l431xx.h"
  125. #elif defined(STM32L432xx)
  126. #include "stm32l432xx.h"
  127. #elif defined(STM32L433xx)
  128. #include "stm32l433xx.h"
  129. #elif defined(STM32L442xx)
  130. #include "stm32l442xx.h"
  131. #elif defined(STM32L443xx)
  132. #include "stm32l443xx.h"
  133. #elif defined(STM32L451xx)
  134. #include "stm32l451xx.h"
  135. #elif defined(STM32L452xx)
  136. #include "stm32l452xx.h"
  137. #elif defined(STM32L462xx)
  138. #include "stm32l462xx.h"
  139. #elif defined(STM32L471xx)
  140. #include "stm32l471xx.h"
  141. #elif defined(STM32L475xx)
  142. #include "stm32l475xx.h"
  143. #elif defined(STM32L476xx)
  144. #include "stm32l476xx.h"
  145. #elif defined(STM32L485xx)
  146. #include "stm32l485xx.h"
  147. #elif defined(STM32L486xx)
  148. #include "stm32l486xx.h"
  149. #elif defined(STM32L496xx)
  150. #include "stm32l496xx.h"
  151. #elif defined(STM32L4A6xx)
  152. #include "stm32l4a6xx.h"
  153. #elif defined(STM32L4R5xx)
  154. #include "stm32l4r5xx.h"
  155. #elif defined(STM32L4R7xx)
  156. #include "stm32l4r7xx.h"
  157. #elif defined(STM32L4R9xx)
  158. #include "stm32l4r9xx.h"
  159. #elif defined(STM32L4S5xx)
  160. #include "stm32l4s5xx.h"
  161. #elif defined(STM32L4S7xx)
  162. #include "stm32l4s7xx.h"
  163. #elif defined(STM32L4S9xx)
  164. #include "stm32l4s9xx.h"
  165. #else
  166. #error "Please select first the target STM32L4xx device used in your application (in stm32l4xx.h file)"
  167. #endif
  168. /**
  169. * @}
  170. */
  171. /** @addtogroup Exported_types
  172. * @{
  173. */
  174. typedef enum
  175. {
  176. RESET = 0,
  177. SET = !RESET
  178. } FlagStatus, ITStatus;
  179. typedef enum
  180. {
  181. DISABLE = 0,
  182. ENABLE = !DISABLE
  183. } FunctionalState;
  184. #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
  185. typedef enum
  186. {
  187. ERROR = 0,
  188. SUCCESS = !ERROR
  189. } ErrorStatus;
  190. /**
  191. * @}
  192. */
  193. /** @addtogroup Exported_macros
  194. * @{
  195. */
  196. #define SET_BIT(REG, BIT) ((REG) |= (BIT))
  197. #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
  198. #define READ_BIT(REG, BIT) ((REG) & (BIT))
  199. #define CLEAR_REG(REG) ((REG) = (0x0))
  200. #define WRITE_REG(REG, VAL) ((REG) = (VAL))
  201. #define READ_REG(REG) ((REG))
  202. #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
  203. #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
  204. /**
  205. * @}
  206. */
  207. #if defined (USE_HAL_DRIVER)
  208. #include "stm32l4xx_hal.h"
  209. #endif /* USE_HAL_DRIVER */
  210. #ifdef __cplusplus
  211. }
  212. #endif /* __cplusplus */
  213. #endif /* __STM32L4xx_H */
  214. /**
  215. * @}
  216. */
  217. /**
  218. * @}
  219. */
  220. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/