stm32l5xx.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. /**
  2. ******************************************************************************
  3. * @file stm32l5xx.h
  4. * @author MCD Application Team
  5. * @brief CMSIS STM32L5xx 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 STM32L5xx 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) 2019 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 stm32l5xx
  33. * @{
  34. */
  35. #ifndef STM32L5xx_H
  36. #define STM32L5xx_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 (STM32L5)
  47. #define STM32L5
  48. #endif /* STM32L5 */
  49. /* Uncomment the line below according to the target STM32L5 device used in your
  50. application
  51. */
  52. #if !defined (STM32L552xx) && !defined (STM32L562xx)
  53. /* #define STM32L552xx */ /*!< STM32L552xx Devices */
  54. /* #define STM32L562xx */ /*!< STM32L562xx Devices */
  55. #endif
  56. /* Tip: To avoid modifying this file each time you need to switch between these
  57. devices, you can define the device in your toolchain compiler preprocessor.
  58. */
  59. #if !defined (USE_HAL_DRIVER)
  60. /**
  61. * @brief Comment the line below if you will not use the peripherals drivers.
  62. In this case, these drivers will not be included and the application code will
  63. be based on direct access to peripherals registers
  64. */
  65. /*#define USE_HAL_DRIVER */
  66. #endif /* USE_HAL_DRIVER */
  67. /**
  68. * @brief CMSIS Device version number
  69. */
  70. #define __STM32L5_CMSIS_VERSION_MAIN (0x01U) /*!< [31:24] main version */
  71. #define __STM32L5_CMSIS_VERSION_SUB1 (0x00U) /*!< [23:16] sub1 version */
  72. #define __STM32L5_CMSIS_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */
  73. #define __STM32L5_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
  74. #define __STM32L5_CMSIS_VERSION ((__STM32L5_CMSIS_VERSION_MAIN << 24U)\
  75. |(__STM32L5_CMSIS_VERSION_SUB1 << 16U)\
  76. |(__STM32L5_CMSIS_VERSION_SUB2 << 8U )\
  77. |(__STM32L5_CMSIS_VERSION_RC))
  78. /**
  79. * @}
  80. */
  81. /** @addtogroup Device_Included
  82. * @{
  83. */
  84. #if defined(STM32L552xx)
  85. #include "stm32l552xx.h"
  86. #elif defined(STM32L562xx)
  87. #include "stm32l562xx.h"
  88. #else
  89. #error "Please select first the target STM32L5xx device used in your application (in stm32l5xx.h file)"
  90. #endif
  91. /**
  92. * @}
  93. */
  94. /** @addtogroup Exported_types
  95. * @{
  96. */
  97. typedef enum
  98. {
  99. RESET = 0,
  100. SET = !RESET
  101. } FlagStatus, ITStatus;
  102. typedef enum
  103. {
  104. DISABLE = 0,
  105. ENABLE = !DISABLE
  106. } FunctionalState;
  107. #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
  108. typedef enum
  109. {
  110. SUCCESS = 0,
  111. ERROR = !SUCCESS
  112. } ErrorStatus;
  113. /**
  114. * @}
  115. */
  116. /** @addtogroup Exported_macros
  117. * @{
  118. */
  119. #define SET_BIT(REG, BIT) ((REG) |= (BIT))
  120. #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
  121. #define READ_BIT(REG, BIT) ((REG) & (BIT))
  122. #define CLEAR_REG(REG) ((REG) = (0x0))
  123. #define WRITE_REG(REG, VAL) ((REG) = (VAL))
  124. #define READ_REG(REG) ((REG))
  125. #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
  126. #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
  127. /**
  128. * @}
  129. */
  130. #if defined (USE_HAL_DRIVER)
  131. #include "stm32l5xx_hal.h"
  132. #endif /* USE_HAL_DRIVER */
  133. #ifdef __cplusplus
  134. }
  135. #endif /* __cplusplus */
  136. #endif /* STM32L5xx_H */
  137. /**
  138. * @}
  139. */
  140. /**
  141. * @}
  142. */
  143. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/