stm32l0xx.h 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. /**
  2. ******************************************************************************
  3. * @file stm32l0xx.h
  4. * @author MCD Application Team
  5. * @version V1.7.0
  6. * @date 31-May-2016
  7. * @brief CMSIS Cortex-M0+ Device Peripheral Access Layer Header File.
  8. * This file contains all the peripheral register's definitions, bits
  9. * definitions and memory mapping for STM32L0xx devices.
  10. *
  11. * The file is the unique include file that the application programmer
  12. * is using in the C source code, usually in main.c. This file contains:
  13. * - Configuration section that allows to select:
  14. * - The device used in the target application
  15. * - To use or not the peripheral's drivers in application code(i.e.
  16. * code will be based on direct access to peripheral's registers
  17. * rather than drivers API), this option is controlled by
  18. * "#define USE_HAL_DRIVER"
  19. *
  20. ******************************************************************************
  21. * @attention
  22. *
  23. * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2>
  24. *
  25. * Redistribution and use in source and binary forms, with or without modification,
  26. * are permitted provided that the following conditions are met:
  27. * 1. Redistributions of source code must retain the above copyright notice,
  28. * this list of conditions and the following disclaimer.
  29. * 2. Redistributions in binary form must reproduce the above copyright notice,
  30. * this list of conditions and the following disclaimer in the documentation
  31. * and/or other materials provided with the distribution.
  32. * 3. Neither the name of STMicroelectronics nor the names of its contributors
  33. * may be used to endorse or promote products derived from this software
  34. * without specific prior written permission.
  35. *
  36. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  37. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  38. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  39. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  40. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  41. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  42. * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  43. * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  44. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  45. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  46. *
  47. ******************************************************************************
  48. */
  49. /** @addtogroup CMSIS
  50. * @{
  51. */
  52. /** @addtogroup stm32l0xx
  53. * @{
  54. */
  55. #ifndef __STM32L0xx_H
  56. #define __STM32L0xx_H
  57. #ifdef __cplusplus
  58. extern "C" {
  59. #endif /* __cplusplus */
  60. /** @addtogroup Library_configuration_section
  61. * @{
  62. */
  63. /**
  64. * @brief STM32 Family
  65. */
  66. #if !defined (STM32L0)
  67. #define STM32L0
  68. #endif /* STM32L0 */
  69. /* Uncomment the line below according to the target STM32 device used in your
  70. application
  71. */
  72. #if !defined (STM32L011xx) && !defined (STM32L021xx) && \
  73. !defined (STM32L031xx) && !defined (STM32L041xx) && \
  74. !defined (STM32L051xx) && !defined (STM32L052xx) && !defined (STM32L053xx) && \
  75. !defined (STM32L061xx) && !defined (STM32L062xx) && !defined (STM32L063xx) && \
  76. !defined (STM32L071xx) && !defined (STM32L072xx) && !defined (STM32L073xx) && \
  77. !defined (STM32L081xx) && !defined (STM32L082xx) && !defined (STM32L083xx) \
  78. /* #define STM32L011xx */
  79. /* #define STM32L021xx */
  80. /* #define STM32L031xx */ /*!< STM32L031C6, STM32L031E6, STM32L031F6, STM32L031G6, STM32L031K6 Devices */
  81. /* #define STM32L041xx */ /*!< STM32L041C6, STM32L041E6, STM32L041F6, STM32L041G6, STM32L041K6 Devices */
  82. /* #define STM32L051xx */ /*!< STM32L051K8, STM32L051C6, STM32L051C8, STM32L051R6, STM32L051R8 Devices */
  83. /* #define STM32L052xx */ /*!< STM32L052K6, STM32L052K8, STM32L052C6, STM32L052C8, STM32L052R6, STM32L052R8 Devices */
  84. /* #define STM32L053xx */ /*!< STM32L053C6, STM32L053C8, STM32L053R6, STM32L053R8 Devices */
  85. /* #define STM32L061xx */ /*!< */
  86. /* #define STM32L062xx */ /*!< STM32L062K8 */
  87. /* #define STM32L063xx */ /*!< STM32L063C8, STM32L063R8 */
  88. /* #define STM32L071xx */ /*!< */
  89. /* #define STM32L072xx */ /*!< */
  90. /* #define STM32L073xx */ /*!< STM32L073V8, STM32L073VB, STM32L073RB, STM32L073VZ, STM32L073RZ Devices */
  91. /* #define STM32L081xx */ /*!< */
  92. /* #define STM32L082xx */ /*!< */
  93. /* #define STM32L083xx */ /*!< */
  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 V1.7.0
  108. */
  109. #define __STM32L0xx_CMSIS_VERSION_MAIN (0x01) /*!< [31:24] main version */
  110. #define __STM32L0xx_CMSIS_VERSION_SUB1 (0x07) /*!< [23:16] sub1 version */
  111. #define __STM32L0xx_CMSIS_VERSION_SUB2 (0x00) /*!< [15:8] sub2 version */
  112. #define __STM32L0xx_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */
  113. #define __STM32L0xx_CMSIS_VERSION ((__STM32L0xx_CMSIS_VERSION_MAIN << 24)\
  114. |(__STM32L0xx_CMSIS_VERSION_SUB1 << 16)\
  115. |(__STM32L0xx_CMSIS_VERSION_SUB2 << 8 )\
  116. |(__STM32L0xx_CMSIS_VERSION_RC))
  117. /**
  118. * @}
  119. */
  120. /** @addtogroup Device_Included
  121. * @{
  122. */
  123. #if defined(STM32L011xx)
  124. #include "stm32l011xx.h"
  125. #elif defined(STM32L021xx)
  126. #include "stm32l021xx.h"
  127. #elif defined(STM32L031xx)
  128. #include "stm32l031xx.h"
  129. #elif defined(STM32L041xx)
  130. #include "stm32l041xx.h"
  131. #elif defined(STM32L051xx)
  132. #include "stm32l051xx.h"
  133. #elif defined(STM32L052xx)
  134. #include "stm32l052xx.h"
  135. #elif defined(STM32L053xx)
  136. #include "stm32l053xx.h"
  137. #elif defined(STM32L062xx)
  138. #include "stm32l062xx.h"
  139. #elif defined(STM32L063xx)
  140. #include "stm32l063xx.h"
  141. #elif defined(STM32L061xx)
  142. #include "stm32l061xx.h"
  143. #elif defined(STM32L071xx)
  144. #include "stm32l071xx.h"
  145. #elif defined(STM32L072xx)
  146. #include "stm32l072xx.h"
  147. #elif defined(STM32L073xx)
  148. #include "stm32l073xx.h"
  149. #elif defined(STM32L082xx)
  150. #include "stm32l082xx.h"
  151. #elif defined(STM32L083xx)
  152. #include "stm32l083xx.h"
  153. #elif defined(STM32L081xx)
  154. #include "stm32l081xx.h"
  155. #else
  156. #error "Please select first the target STM32L0xx device used in your application (in stm32l0xx.h file)"
  157. #endif
  158. /**
  159. * @}
  160. */
  161. /** @addtogroup Exported_types
  162. * @{
  163. */
  164. typedef enum
  165. {
  166. RESET = 0,
  167. SET = !RESET
  168. } FlagStatus, ITStatus;
  169. typedef enum
  170. {
  171. DISABLE = 0,
  172. ENABLE = !DISABLE
  173. } FunctionalState;
  174. #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
  175. typedef enum
  176. {
  177. ERROR = 0,
  178. SUCCESS = !ERROR
  179. } ErrorStatus;
  180. /**
  181. * @}
  182. */
  183. /** @addtogroup Exported_macro
  184. * @{
  185. */
  186. #define SET_BIT(REG, BIT) ((REG) |= (BIT))
  187. #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
  188. #define READ_BIT(REG, BIT) ((REG) & (BIT))
  189. #define CLEAR_REG(REG) ((REG) = (0x0))
  190. #define WRITE_REG(REG, VAL) ((REG) = (VAL))
  191. #define READ_REG(REG) ((REG))
  192. #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
  193. /**
  194. * @}
  195. */
  196. #if defined (USE_HAL_DRIVER)
  197. #include "stm32l0xx_hal.h"
  198. #endif /* USE_HAL_DRIVER */
  199. #ifdef __cplusplus
  200. }
  201. #endif /* __cplusplus */
  202. #endif /* __STM32L0xx_H */
  203. /**
  204. * @}
  205. */
  206. /**
  207. * @}
  208. */
  209. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/