stm32l0xx.h 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. /**
  2. ******************************************************************************
  3. * @file stm32l0xx.h
  4. * @author MCD Application Team
  5. * @brief CMSIS Cortex-M0+ Device Peripheral Access Layer Header File.
  6. * This file contains all the peripheral register's definitions, bits
  7. * definitions and memory mapping for STM32L0xx devices.
  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 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) 2016 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 stm32l0xx
  51. * @{
  52. */
  53. #ifndef __STM32L0xx_H
  54. #define __STM32L0xx_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 (STM32L0)
  65. #define STM32L0
  66. #endif /* STM32L0 */
  67. /* Uncomment the line below according to the target STM32 device used in your
  68. application
  69. */
  70. #if !defined (STM32L011xx) && !defined (STM32L021xx) && \
  71. !defined (STM32L031xx) && !defined (STM32L041xx) && \
  72. !defined (STM32L051xx) && !defined (STM32L052xx) && !defined (STM32L053xx) && \
  73. !defined (STM32L061xx) && !defined (STM32L062xx) && !defined (STM32L063xx) && \
  74. !defined (STM32L071xx) && !defined (STM32L072xx) && !defined (STM32L073xx) && \
  75. !defined (STM32L081xx) && !defined (STM32L082xx) && !defined (STM32L083xx) \
  76. /* #define STM32L011xx */
  77. /* #define STM32L021xx */
  78. /* #define STM32L031xx */ /*!< STM32L031C6, STM32L031E6, STM32L031F6, STM32L031G6, STM32L031K6 Devices */
  79. /* #define STM32L041xx */ /*!< STM32L041C6, STM32L041E6, STM32L041F6, STM32L041G6, STM32L041K6 Devices */
  80. /* #define STM32L051xx */ /*!< STM32L051K8, STM32L051C6, STM32L051C8, STM32L051R6, STM32L051R8 Devices */
  81. /* #define STM32L052xx */ /*!< STM32L052K6, STM32L052K8, STM32L052C6, STM32L052C8, STM32L052R6, STM32L052R8 Devices */
  82. /* #define STM32L053xx */ /*!< STM32L053C6, STM32L053C8, STM32L053R6, STM32L053R8 Devices */
  83. /* #define STM32L061xx */ /*!< */
  84. /* #define STM32L062xx */ /*!< STM32L062K8 */
  85. /* #define STM32L063xx */ /*!< STM32L063C8, STM32L063R8 */
  86. /* #define STM32L071xx */ /*!< */
  87. /* #define STM32L072xx */ /*!< */
  88. /* #define STM32L073xx */ /*!< STM32L073V8, STM32L073VB, STM32L073RB, STM32L073VZ, STM32L073RZ Devices */
  89. /* #define STM32L081xx */ /*!< */
  90. /* #define STM32L082xx */ /*!< */
  91. /* #define STM32L083xx */ /*!< */
  92. #endif
  93. /* Tip: To avoid modifying this file each time you need to switch between these
  94. devices, you can define the device in your toolchain compiler preprocessor.
  95. */
  96. #if !defined (USE_HAL_DRIVER)
  97. /**
  98. * @brief Comment the line below if you will not use the peripherals drivers.
  99. In this case, these drivers will not be included and the application code will
  100. be based on direct access to peripherals registers
  101. */
  102. /*#define USE_HAL_DRIVER */
  103. #endif /* USE_HAL_DRIVER */
  104. /**
  105. * @brief CMSIS Device version number V1.7.1
  106. */
  107. #define __STM32L0xx_CMSIS_VERSION_MAIN (0x01) /*!< [31:24] main version */
  108. #define __STM32L0xx_CMSIS_VERSION_SUB1 (0x07) /*!< [23:16] sub1 version */
  109. #define __STM32L0xx_CMSIS_VERSION_SUB2 (0x02) /*!< [15:8] sub2 version */
  110. #define __STM32L0xx_CMSIS_VERSION_RC (0x00) /*!< [7:0] release candidate */
  111. #define __STM32L0xx_CMSIS_VERSION ((__STM32L0xx_CMSIS_VERSION_MAIN << 24)\
  112. |(__STM32L0xx_CMSIS_VERSION_SUB1 << 16)\
  113. |(__STM32L0xx_CMSIS_VERSION_SUB2 << 8 )\
  114. |(__STM32L0xx_CMSIS_VERSION_RC))
  115. /**
  116. * @}
  117. */
  118. /** @addtogroup Device_Included
  119. * @{
  120. */
  121. #if defined(STM32L011xx)
  122. #include "stm32l011xx.h"
  123. #elif defined(STM32L021xx)
  124. #include "stm32l021xx.h"
  125. #elif defined(STM32L031xx)
  126. #include "stm32l031xx.h"
  127. #elif defined(STM32L041xx)
  128. #include "stm32l041xx.h"
  129. #elif defined(STM32L051xx)
  130. #include "stm32l051xx.h"
  131. #elif defined(STM32L052xx)
  132. #include "stm32l052xx.h"
  133. #elif defined(STM32L053xx)
  134. #include "stm32l053xx.h"
  135. #elif defined(STM32L062xx)
  136. #include "stm32l062xx.h"
  137. #elif defined(STM32L063xx)
  138. #include "stm32l063xx.h"
  139. #elif defined(STM32L061xx)
  140. #include "stm32l061xx.h"
  141. #elif defined(STM32L071xx)
  142. #include "stm32l071xx.h"
  143. #elif defined(STM32L072xx)
  144. #include "stm32l072xx.h"
  145. #elif defined(STM32L073xx)
  146. #include "stm32l073xx.h"
  147. #elif defined(STM32L082xx)
  148. #include "stm32l082xx.h"
  149. #elif defined(STM32L083xx)
  150. #include "stm32l083xx.h"
  151. #elif defined(STM32L081xx)
  152. #include "stm32l081xx.h"
  153. #else
  154. #error "Please select first the target STM32L0xx device used in your application (in stm32l0xx.h file)"
  155. #endif
  156. /**
  157. * @}
  158. */
  159. /** @addtogroup Exported_types
  160. * @{
  161. */
  162. typedef enum
  163. {
  164. RESET = 0,
  165. SET = !RESET
  166. } FlagStatus, ITStatus;
  167. typedef enum
  168. {
  169. DISABLE = 0,
  170. ENABLE = !DISABLE
  171. } FunctionalState;
  172. #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
  173. typedef enum
  174. {
  175. ERROR = 0,
  176. SUCCESS = !ERROR
  177. } ErrorStatus;
  178. /**
  179. * @}
  180. */
  181. /** @addtogroup Exported_macro
  182. * @{
  183. */
  184. #define SET_BIT(REG, BIT) ((REG) |= (BIT))
  185. #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
  186. #define READ_BIT(REG, BIT) ((REG) & (BIT))
  187. #define CLEAR_REG(REG) ((REG) = (0x0))
  188. #define WRITE_REG(REG, VAL) ((REG) = (VAL))
  189. #define READ_REG(REG) ((REG))
  190. #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
  191. /**
  192. * @}
  193. */
  194. #if defined (USE_HAL_DRIVER)
  195. #include "stm32l0xx_hal.h"
  196. #endif /* USE_HAL_DRIVER */
  197. #ifdef __cplusplus
  198. }
  199. #endif /* __cplusplus */
  200. #endif /* __STM32L0xx_H */
  201. /**
  202. * @}
  203. */
  204. /**
  205. * @}
  206. */
  207. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/