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.

stm32l1xx.h 8.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246
  1. /**
  2. ******************************************************************************
  3. * @file stm32l1xx.h
  4. * @author MCD Application Team
  5. * @brief CMSIS STM32L1xx 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 STM32L1xx 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.
  20. * All rights reserved.</center></h2>
  21. *
  22. * This software component is licensed by ST under BSD 3-Clause license,
  23. * the "License"; You may not use this file except in compliance with the
  24. * License. You may obtain a copy of the License at:
  25. * opensource.org/licenses/BSD-3-Clause
  26. *
  27. ******************************************************************************
  28. */
  29. /** @addtogroup CMSIS
  30. * @{
  31. */
  32. /** @addtogroup stm32l1xx
  33. * @{
  34. */
  35. #ifndef __STM32L1XX_H
  36. #define __STM32L1XX_H
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif /* __cplusplus */
  40. /** @addtogroup Library_configuration_section
  41. * @{
  42. */
  43. /**
  44. * @brief STM32 Family
  45. */
  46. #if !defined (STM32L1)
  47. #define STM32L1
  48. #endif /* STM32L1 */
  49. /* Uncomment the line below according to the target STM32L device used in your
  50. application
  51. */
  52. #if !defined (STM32L100xB) && !defined (STM32L100xBA) && !defined (STM32L100xC) && \
  53. !defined (STM32L151xB) && !defined (STM32L151xBA) && !defined (STM32L151xC) && !defined (STM32L151xCA) && !defined (STM32L151xD) && !defined (STM32L151xDX) && !defined (STM32L151xE) && \
  54. !defined (STM32L152xB) && !defined (STM32L152xBA) && !defined (STM32L152xC) && !defined (STM32L152xCA) && !defined (STM32L152xD) && !defined (STM32L152xDX) && !defined (STM32L152xE) && \
  55. !defined (STM32L162xC) && !defined (STM32L162xCA) && !defined (STM32L162xD) && !defined (STM32L162xDX) && !defined (STM32L162xE)
  56. /* #define STM32L100xB */ /*!< STM32L100C6, STM32L100R and STM32L100RB Devices */
  57. /* #define STM32L100xBA */ /*!< STM32L100C6-A, STM32L100R8-A and STM32L100RB-A Devices */
  58. /* #define STM32L100xC */ /*!< STM32L100RC Devices */
  59. /* #define STM32L151xB */ /*!< STM32L151C6, STM32L151R6, STM32L151C8, STM32L151R8, STM32L151V8, STM32L151CB, STM32L151RB and STM32L151VB */
  60. /* #define STM32L151xBA */ /*!< STM32L151C6-A, STM32L151R6-A, STM32L151C8-A, STM32L151R8-A, STM32L151V8-A, STM32L151CB-A, STM32L151RB-A and STM32L151VB-A */
  61. /* #define STM32L151xC */ /*!< STM32L151CC, STM32L151UC, STM32L151RC and STM32L151VC */
  62. /* #define STM32L151xCA */ /*!< STM32L151RC-A, STM32L151VC-A, STM32L151QC and STM32L151ZC */
  63. /* #define STM32L151xD */ /*!< STM32L151QD, STM32L151RD, STM32L151VD & STM32L151ZD */
  64. /* #define STM32L151xDX */ /*!< STM32L151VD-X Devices */
  65. /* #define STM32L151xE */ /*!< STM32L151QE, STM32L151RE, STM32L151VE and STM32L151ZE */
  66. /* #define STM32L152xB */ /*!< STM32L152C6, STM32L152R6, STM32L152C8, STM32L152R8, STM32L152V8, STM32L152CB, STM32L152RB and STM32L152VB */
  67. /* #define STM32L152xBA */ /*!< STM32L152C6-A, STM32L152R6-A, STM32L152C8-A, STM32L152R8-A, STM32L152V8-A, STM32L152CB-A, STM32L152RB-A and STM32L152VB-A */
  68. /* #define STM32L152xC */ /*!< STM32L152CC, STM32L152UC, STM32L152RC and STM32L152VC */
  69. /* #define STM32L152xCA */ /*!< STM32L152RC-A, STM32L152VC-A, STM32L152QC and STM32L152ZC */
  70. /* #define STM32L152xD */ /*!< STM32L152QD, STM32L152RD, STM32L152VD and STM32L152ZD */
  71. /* #define STM32L152xDX */ /*!< STM32L152VD-X Devices */
  72. /* #define STM32L152xE */ /*!< STM32L152QE, STM32L152RE, STM32L152VE and STM32L152ZE */
  73. /* #define STM32L162xC */ /*!< STM32L162RC and STM32L162VC */
  74. /* #define STM32L162xCA */ /*!< STM32L162RC-A, STM32L162VC-A, STM32L162QC and STM32L162ZC */
  75. /* #define STM32L162xD */ /*!< STM32L162QD, STM32L162RD, STM32L162VD and STM32L162ZD */
  76. /* #define STM32L162xDX */ /*!< STM32L162VD-X Devices */
  77. /* #define STM32L162xE */ /*!< STM32L162RE, STM32L162VE and STM32L162ZE */
  78. #endif
  79. /* Tip: To avoid modifying this file each time you need to switch between these
  80. devices, you can define the device in your toolchain compiler preprocessor.
  81. */
  82. #if !defined (USE_HAL_DRIVER)
  83. /**
  84. * @brief Comment the line below if you will not use the peripherals drivers.
  85. In this case, these drivers will not be included and the application code will
  86. be based on direct access to peripherals registers
  87. */
  88. /*#define USE_HAL_DRIVER */
  89. #endif /* USE_HAL_DRIVER */
  90. /**
  91. * @brief CMSIS Device version number V2.3.1
  92. */
  93. #define __STM32L1xx_CMSIS_VERSION_MAIN (0x02) /*!< [31:24] main version */
  94. #define __STM32L1xx_CMSIS_VERSION_SUB1 (0x03) /*!< [23:16] sub1 version */
  95. #define __STM32L1xx_CMSIS_VERSION_SUB2 (0x01) /*!< [15:8] sub2 version */
  96. #define __STM32L1xx_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */
  97. #define __STM32L1xx_CMSIS_VERSION ((__STM32L1xx_CMSIS_VERSION_MAIN << 24)\
  98. |(__STM32L1xx_CMSIS_VERSION_SUB1 << 16)\
  99. |(__STM32L1xx_CMSIS_VERSION_SUB2 << 8 )\
  100. |(__STM32L1xx_CMSIS_VERSION_RC))
  101. /**
  102. * @}
  103. */
  104. /** @addtogroup Device_Included
  105. * @{
  106. */
  107. #if defined(STM32L100xB)
  108. #include "stm32l100xb.h"
  109. #elif defined(STM32L100xBA)
  110. #include "stm32l100xba.h"
  111. #elif defined(STM32L100xC)
  112. #include "stm32l100xc.h"
  113. #elif defined(STM32L151xB)
  114. #include "stm32l151xb.h"
  115. #elif defined(STM32L151xBA)
  116. #include "stm32l151xba.h"
  117. #elif defined(STM32L151xC)
  118. #include "stm32l151xc.h"
  119. #elif defined(STM32L151xCA)
  120. #include "stm32l151xca.h"
  121. #elif defined(STM32L151xD)
  122. #include "stm32l151xd.h"
  123. #elif defined(STM32L151xDX)
  124. #include "stm32l151xdx.h"
  125. #elif defined(STM32L151xE)
  126. #include "stm32l151xe.h"
  127. #elif defined(STM32L152xB)
  128. #include "stm32l152xb.h"
  129. #elif defined(STM32L152xBA)
  130. #include "stm32l152xba.h"
  131. #elif defined(STM32L152xC)
  132. #include "stm32l152xc.h"
  133. #elif defined(STM32L152xCA)
  134. #include "stm32l152xca.h"
  135. #elif defined(STM32L152xD)
  136. #include "stm32l152xd.h"
  137. #elif defined(STM32L152xDX)
  138. #include "stm32l152xdx.h"
  139. #elif defined(STM32L152xE)
  140. #include "stm32l152xe.h"
  141. #elif defined(STM32L162xC)
  142. #include "stm32l162xc.h"
  143. #elif defined(STM32L162xCA)
  144. #include "stm32l162xca.h"
  145. #elif defined(STM32L162xD)
  146. #include "stm32l162xd.h"
  147. #elif defined(STM32L162xDX)
  148. #include "stm32l162xdx.h"
  149. #elif defined(STM32L162xE)
  150. #include "stm32l162xe.h"
  151. #else
  152. #error "Please select first the target STM32L1xx device used in your application (in stm32l1xx.h file)"
  153. #endif
  154. /**
  155. * @}
  156. */
  157. /** @addtogroup Exported_types
  158. * @{
  159. */
  160. typedef enum
  161. {
  162. RESET = 0,
  163. SET = !RESET
  164. } FlagStatus, ITStatus;
  165. typedef enum
  166. {
  167. DISABLE = 0,
  168. ENABLE = !DISABLE
  169. } FunctionalState;
  170. #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
  171. typedef enum
  172. {
  173. SUCCESS = 0,
  174. ERROR = !SUCCESS
  175. } ErrorStatus;
  176. /**
  177. * @}
  178. */
  179. /** @addtogroup Exported_macros
  180. * @{
  181. */
  182. #define SET_BIT(REG, BIT) ((REG) |= (BIT))
  183. #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
  184. #define READ_BIT(REG, BIT) ((REG) & (BIT))
  185. #define CLEAR_REG(REG) ((REG) = (0x0))
  186. #define WRITE_REG(REG, VAL) ((REG) = (VAL))
  187. #define READ_REG(REG) ((REG))
  188. #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
  189. #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
  190. /**
  191. * @}
  192. */
  193. #if defined (USE_HAL_DRIVER)
  194. #include "stm32l1xx_hal.h"
  195. #endif /* USE_HAL_DRIVER */
  196. #ifdef __cplusplus
  197. }
  198. #endif /* __cplusplus */
  199. #endif /* __STM32L1xx_H */
  200. /**
  201. * @}
  202. */
  203. /**
  204. * @}
  205. */
  206. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/