You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

241 lines
7.5 KiB

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