stm32f2xx.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /**
  2. ******************************************************************************
  3. * @file stm32f2xx.h
  4. * @author MCD Application Team
  5. * @brief CMSIS STM32F2xx 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 STM32F2xx 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 stm32f2xx
  33. * @{
  34. */
  35. #ifndef __STM32F2xx_H
  36. #define __STM32F2xx_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 (STM32F2)
  47. #define STM32F2
  48. #endif /* STM32F2 */
  49. /* Uncomment the line below according to the target STM32 device used in your
  50. application
  51. */
  52. #if !defined (STM32F205xx) && !defined (STM32F215xx) && !defined (STM32F207xx) && !defined (STM32F217xx)
  53. /* #define STM32F205xx */ /*!< STM32F205RG, STM32F205VG, STM32F205ZG, STM32F205RF, STM32F205VF, STM32F205ZF,
  54. STM32F205RE, STM32F205VE, STM32F205ZE, STM32F205RC, STM32F205VC, STM32F205ZC,
  55. STM32F205RB and STM32F205VB Devices */
  56. /* #define STM32F215xx */ /*!< STM32F215RG, STM32F215VG, STM32F215ZG, STM32F215RE, STM32F215VE and STM32F215ZE Devices */
  57. /* #define STM32F207xx */ /*!< STM32F207VG, STM32F207ZG, STM32F207IG, STM32F207VF, STM32F207ZF, STM32F207IF,
  58. STM32F207VE, STM32F207ZE, STM32F207IE, STM32F207VC, STM32F207ZC and STM32F207IC Devices */
  59. /* #define STM32F217xx */ /*!< STM32F217VG, STM32F217ZG, STM32F217IG, STM32F217VE, STM32F217ZE and STM32F217IE Devices */
  60. #endif
  61. /* Tip: To avoid modifying this file each time you need to switch between these
  62. devices, you can define the device in your toolchain compiler preprocessor.
  63. */
  64. #if !defined (USE_HAL_DRIVER)
  65. /**
  66. * @brief Comment the line below if you will not use the peripherals drivers.
  67. In this case, these drivers will not be included and the application code will
  68. be based on direct access to peripherals registers
  69. */
  70. /*#define USE_HAL_DRIVER */
  71. #endif /* USE_HAL_DRIVER */
  72. /**
  73. * @brief CMSIS Device version number V2.2.3
  74. */
  75. #define __STM32F2xx_CMSIS_VERSION_MAIN (0x02U) /*!< [31:24] main version */
  76. #define __STM32F2xx_CMSIS_VERSION_SUB1 (0x02U) /*!< [23:16] sub1 version */
  77. #define __STM32F2xx_CMSIS_VERSION_SUB2 (0x03U) /*!< [15:8] sub2 version */
  78. #define __STM32F2xx_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
  79. #define __STM32F2xx_CMSIS_VERSION ((__STM32F2xx_CMSIS_VERSION_MAIN << 24)\
  80. |(__STM32F2xx_CMSIS_VERSION_SUB1 << 16)\
  81. |(__STM32F2xx_CMSIS_VERSION_SUB2 << 8 )\
  82. |(__STM32F2xx_CMSIS_VERSION))
  83. /**
  84. * @}
  85. */
  86. /** @addtogroup Device_Included
  87. * @{
  88. */
  89. #if defined(STM32F205xx)
  90. #include "stm32f205xx.h"
  91. #elif defined(STM32F215xx)
  92. #include "stm32f215xx.h"
  93. #elif defined(STM32F207xx)
  94. #include "stm32f207xx.h"
  95. #elif defined(STM32F217xx)
  96. #include "stm32f217xx.h"
  97. #else
  98. #error "Please select first the target STM32F2xx device used in your application (in stm32f2xx.h file)"
  99. #endif
  100. /**
  101. * @}
  102. */
  103. /** @addtogroup Exported_types
  104. * @{
  105. */
  106. typedef enum
  107. {
  108. RESET = 0U,
  109. SET = !RESET
  110. } FlagStatus, ITStatus;
  111. typedef enum
  112. {
  113. DISABLE = 0U,
  114. ENABLE = !DISABLE
  115. } FunctionalState;
  116. #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
  117. typedef enum
  118. {
  119. SUCCESS = 0U,
  120. ERROR = !SUCCESS
  121. } ErrorStatus;
  122. /**
  123. * @}
  124. */
  125. /** @addtogroup Exported_macro
  126. * @{
  127. */
  128. #define SET_BIT(REG, BIT) ((REG) |= (BIT))
  129. #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
  130. #define READ_BIT(REG, BIT) ((REG) & (BIT))
  131. #define CLEAR_REG(REG) ((REG) = (0x0))
  132. #define WRITE_REG(REG, VAL) ((REG) = (VAL))
  133. #define READ_REG(REG) ((REG))
  134. #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
  135. #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
  136. /**
  137. * @}
  138. */
  139. #if defined (USE_HAL_DRIVER)
  140. #include "stm32f2xx_hal.h"
  141. #endif /* USE_HAL_DRIVER */
  142. #ifdef __cplusplus
  143. }
  144. #endif /* __cplusplus */
  145. #endif /* __STM32F2xx_H */
  146. /**
  147. * @}
  148. */
  149. /**
  150. * @}
  151. */
  152. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/