stm32g0xx.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. /**
  2. ******************************************************************************
  3. * @file stm32g0xx.h
  4. * @author MCD Application Team
  5. * @brief CMSIS STM32G0xx 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 STM32G0xx device used in the target application
  11. * - To use or not the peripherals drivers in application code(i.e.
  12. * code will be based on direct access to peripherals 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) 2018 STMicroelectronics.
  20. * All rights reserved.</center></h2>
  21. *
  22. * This software component is licensed by ST under Apache License, Version 2.0,
  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/Apache-2.0
  26. *
  27. ******************************************************************************
  28. */
  29. /** @addtogroup CMSIS
  30. * @{
  31. */
  32. /** @addtogroup stm32g0xx
  33. * @{
  34. */
  35. #ifndef STM32G0xx_H
  36. #define STM32G0xx_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 (STM32G0)
  47. #define STM32G0
  48. #endif /* STM32G0 */
  49. /* Uncomment the line below according to the target STM32G0 device used in your
  50. application
  51. */
  52. #if !defined (STM32G071xx) && !defined (STM32G081xx) && !defined (STM32G070xx) \
  53. && !defined (STM32G030xx) && !defined (STM32G031xx) && !defined (STM32G041xx) \
  54. && !defined (STM32G0B0xx) && !defined (STM32G0B1xx) && !defined (STM32G0C1xx) \
  55. && !defined (STM32G050xx) && !defined (STM32G051xx) && !defined (STM32G061xx)
  56. /* #define STM32G0B0xx */ /*!< STM32G0B0xx Devices */
  57. /* #define STM32G0B1xx */ /*!< STM32G0B1xx Devices */
  58. /* #define STM32G0C1xx */ /*!< STM32G0C1xx Devices */
  59. /* #define STM32G070xx */ /*!< STM32G070xx Devices */
  60. /* #define STM32G071xx */ /*!< STM32G071xx Devices */
  61. /* #define STM32G081xx */ /*!< STM32G081xx Devices */
  62. /* #define STM32G050xx */ /*!< STM32G050xx Devices */
  63. /* #define STM32G051xx */ /*!< STM32G051xx Devices */
  64. /* #define STM32G061xx */ /*!< STM32G061xx Devices */
  65. /* #define STM32G030xx */ /*!< STM32G030xx Devices */
  66. /* #define STM32G031xx */ /*!< STM32G031xx Devices */
  67. /* #define STM32G041xx */ /*!< STM32G041xx Devices */
  68. #endif
  69. /* Tip: To avoid modifying this file each time you need to switch between these
  70. devices, you can define the device in your toolchain compiler preprocessor.
  71. */
  72. #if !defined (USE_HAL_DRIVER)
  73. /**
  74. * @brief Comment the line below if you will not use the peripherals drivers.
  75. In this case, these drivers will not be included and the application code will
  76. be based on direct access to peripherals registers
  77. */
  78. /*#define USE_HAL_DRIVER */
  79. #endif /* USE_HAL_DRIVER */
  80. /**
  81. * @brief CMSIS Device version number $VERSION$
  82. */
  83. #define __STM32G0_CMSIS_VERSION_MAIN (0x01U) /*!< [31:24] main version */
  84. #define __STM32G0_CMSIS_VERSION_SUB1 (0x04U) /*!< [23:16] sub1 version */
  85. #define __STM32G0_CMSIS_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */
  86. #define __STM32G0_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
  87. #define __STM32G0_CMSIS_VERSION ((__STM32G0_CMSIS_VERSION_MAIN << 24)\
  88. |(__STM32G0_CMSIS_VERSION_SUB1 << 16)\
  89. |(__STM32G0_CMSIS_VERSION_SUB2 << 8 )\
  90. |(__STM32G0_CMSIS_VERSION_RC))
  91. /**
  92. * @}
  93. */
  94. /** @addtogroup Device_Included
  95. * @{
  96. */
  97. #if defined(STM32G0B1xx)
  98. #include "stm32g0b1xx.h"
  99. #elif defined(STM32G0C1xx)
  100. #include "stm32g0c1xx.h"
  101. #elif defined(STM32G0B0xx)
  102. #include "stm32g0b0xx.h"
  103. #elif defined(STM32G071xx)
  104. #include "stm32g071xx.h"
  105. #elif defined(STM32G081xx)
  106. #include "stm32g081xx.h"
  107. #elif defined(STM32G070xx)
  108. #include "stm32g070xx.h"
  109. #elif defined(STM32G031xx)
  110. #include "stm32g031xx.h"
  111. #elif defined(STM32G041xx)
  112. #include "stm32g041xx.h"
  113. #elif defined(STM32G030xx)
  114. #include "stm32g030xx.h"
  115. #elif defined(STM32G051xx)
  116. #include "stm32g051xx.h"
  117. #elif defined(STM32G061xx)
  118. #include "stm32g061xx.h"
  119. #elif defined(STM32G050xx)
  120. #include "stm32g050xx.h"
  121. #else
  122. #error "Please select first the target STM32G0xx device used in your application (in stm32g0xx.h file)"
  123. #endif
  124. /**
  125. * @}
  126. */
  127. /** @addtogroup Exported_types
  128. * @{
  129. */
  130. typedef enum
  131. {
  132. RESET = 0,
  133. SET = !RESET
  134. } FlagStatus, ITStatus;
  135. typedef enum
  136. {
  137. DISABLE = 0,
  138. ENABLE = !DISABLE
  139. } FunctionalState;
  140. #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
  141. typedef enum
  142. {
  143. SUCCESS = 0,
  144. ERROR = !SUCCESS
  145. } ErrorStatus;
  146. /**
  147. * @}
  148. */
  149. /** @addtogroup Exported_macros
  150. * @{
  151. */
  152. #define SET_BIT(REG, BIT) ((REG) |= (BIT))
  153. #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
  154. #define READ_BIT(REG, BIT) ((REG) & (BIT))
  155. #define CLEAR_REG(REG) ((REG) = (0x0))
  156. #define WRITE_REG(REG, VAL) ((REG) = (VAL))
  157. #define READ_REG(REG) ((REG))
  158. #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
  159. /*#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))*/
  160. /**
  161. * @}
  162. */
  163. #if defined (USE_HAL_DRIVER)
  164. #include "stm32g0xx_hal.h"
  165. #endif /* USE_HAL_DRIVER */
  166. #ifdef __cplusplus
  167. }
  168. #endif /* __cplusplus */
  169. #endif /* STM32G0xx_H */
  170. /**
  171. * @}
  172. */
  173. /**
  174. * @}
  175. */
  176. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/