stm32f2xx.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. /**
  2. ******************************************************************************
  3. * @file stm32f2xx.h
  4. * @author MCD Application Team
  5. * @version V2.1.2
  6. * @date 29-June-2016
  7. * @brief CMSIS STM32F2xx Device Peripheral Access Layer Header File.
  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 STM32F2xx 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 stm32f2xx
  51. * @{
  52. */
  53. #ifndef __STM32F2xx_H
  54. #define __STM32F2xx_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 (STM32F2)
  65. #define STM32F2
  66. #endif /* STM32F2 */
  67. /* Uncomment the line below according to the target STM32 device used in your
  68. application
  69. */
  70. #if !defined (STM32F205xx) && !defined (STM32F215xx) && !defined (STM32F207xx) && !defined (STM32F217xx)
  71. /* #define STM32F205xx */ /*!< STM32F205RG, STM32F205VG, STM32F205ZG, STM32F205RF, STM32F205VF, STM32F205ZF,
  72. STM32F205RE, STM32F205VE, STM32F205ZE, STM32F205RC, STM32F205VC, STM32F205ZC,
  73. STM32F205RB and STM32F205VB Devices */
  74. /* #define STM32F215xx */ /*!< STM32F215RG, STM32F215VG, STM32F215ZG, STM32F215RE, STM32F215VE and STM32F215ZE Devices */
  75. /* #define STM32F207xx */ /*!< STM32F207VG, STM32F207ZG, STM32F207IG, STM32F207VF, STM32F207ZF, STM32F207IF,
  76. STM32F207VE, STM32F207ZE, STM32F207IE, STM32F207VC, STM32F207ZC and STM32F207IC Devices */
  77. /* #define STM32F217xx */ /*!< STM32F217VG, STM32F217ZG, STM32F217IG, STM32F217VE, STM32F217ZE and STM32F217IE Devices */
  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.1.2
  92. */
  93. #define __STM32F2xx_CMSIS_VERSION_MAIN (0x02U) /*!< [31:24] main version */
  94. #define __STM32F2xx_CMSIS_VERSION_SUB1 (0x01U) /*!< [23:16] sub1 version */
  95. #define __STM32F2xx_CMSIS_VERSION_SUB2 (0x02U) /*!< [15:8] sub2 version */
  96. #define __STM32F2xx_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
  97. #define __STM32F2xx_CMSIS_VERSION ((__STM32F2xx_CMSIS_VERSION_MAIN << 24)\
  98. |(__STM32F2xx_CMSIS_VERSION_SUB1 << 16)\
  99. |(__STM32F2xx_CMSIS_VERSION_SUB2 << 8 )\
  100. |(__STM32F2xx_CMSIS_VERSION))
  101. /**
  102. * @}
  103. */
  104. /** @addtogroup Device_Included
  105. * @{
  106. */
  107. #if defined(STM32F205xx)
  108. #include "stm32f205xx.h"
  109. #elif defined(STM32F215xx)
  110. #include "stm32f215xx.h"
  111. #elif defined(STM32F207xx)
  112. #include "stm32f207xx.h"
  113. #elif defined(STM32F217xx)
  114. #include "stm32f217xx.h"
  115. #else
  116. #error "Please select first the target STM32F2xx device used in your application (in stm32f2xx.h file)"
  117. #endif
  118. /**
  119. * @}
  120. */
  121. /** @addtogroup Exported_types
  122. * @{
  123. */
  124. typedef enum
  125. {
  126. RESET = 0,
  127. SET = !RESET
  128. } FlagStatus, ITStatus;
  129. typedef enum
  130. {
  131. DISABLE = 0,
  132. ENABLE = !DISABLE
  133. } FunctionalState;
  134. #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
  135. typedef enum
  136. {
  137. ERROR = 0,
  138. SUCCESS = !ERROR
  139. } ErrorStatus;
  140. /**
  141. * @}
  142. */
  143. /** @addtogroup Exported_macro
  144. * @{
  145. */
  146. #define SET_BIT(REG, BIT) ((REG) |= (BIT))
  147. #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
  148. #define READ_BIT(REG, BIT) ((REG) & (BIT))
  149. #define CLEAR_REG(REG) ((REG) = (0x0))
  150. #define WRITE_REG(REG, VAL) ((REG) = (VAL))
  151. #define READ_REG(REG) ((REG))
  152. #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
  153. #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
  154. /**
  155. * @}
  156. */
  157. #if defined (USE_HAL_DRIVER)
  158. #include "stm32f2xx_hal.h"
  159. #endif /* USE_HAL_DRIVER */
  160. #ifdef __cplusplus
  161. }
  162. #endif /* __cplusplus */
  163. #endif /* __STM32F2xx_H */
  164. /**
  165. * @}
  166. */
  167. /**
  168. * @}
  169. */
  170. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/