Merge pull request #11270 from haslinghuis/rename_attr
[betaflight.git] / lib / main / STM32G4 / Drivers / CMSIS / Device / ST / STM32G4xx / Include / stm32g4xx.h
blob6565af3d624afd56ae1c8bb9d0ab962a6c5e600c
1 /**
2 ******************************************************************************
3 * @file stm32g4xx.h
4 * @author MCD Application Team
5 * @brief CMSIS STM32G4xx Device Peripheral Access Layer Header File.
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 STM32G4xx 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"
16 ******************************************************************************
17 * @attention
19 * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
20 * All rights reserved.</center></h2>
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
27 ******************************************************************************
30 /** @addtogroup CMSIS
31 * @{
34 /** @addtogroup stm32g4xx
35 * @{
38 #ifndef __STM32G4xx_H
39 #define __STM32G4xx_H
41 #ifdef __cplusplus
42 extern "C" {
43 #endif /* __cplusplus */
45 /** @addtogroup Library_configuration_section
46 * @{
49 /**
50 * @brief STM32 Family
52 #if !defined (STM32G4)
53 #define STM32G4
54 #endif /* STM32G4 */
56 /* Uncomment the line below according to the target STM32G4 device used in your
57 application
60 #if !defined (STM32G431xx) && !defined (STM32G441xx) && \
61 !defined (STM32G471xx) && !defined (STM32G473xx) && !defined (STM32G474xx) && !defined (STM32G484xx) && !defined (STM32GBK1CB)
62 /* #define STM32G431xx */ /*!< STM32G431xx Devices */
63 /* #define STM32G441xx */ /*!< STM32G441xx Devices */
64 /* #define STM32G471xx */ /*!< STM32G471xx Devices */
65 /* #define STM32G473xx */ /*!< STM32G473xx Devices */
66 /* #define STM32G474xx */ /*!< STM32G474xx Devices */
67 /* #define STM32G484xx */ /*!< STM32G484xx Devices */
68 /* #define STM32GBK1CB */ /*!< STM32GBK1CB Devices */
69 #endif
71 /* Tip: To avoid modifying this file each time you need to switch between these
72 devices, you can define the device in your toolchain compiler preprocessor.
74 #if !defined (USE_HAL_DRIVER)
75 /**
76 * @brief Comment the line below if you will not use the peripherals drivers.
77 In this case, these drivers will not be included and the application code will
78 be based on direct access to peripherals registers
80 /*#define USE_HAL_DRIVER */
81 #endif /* USE_HAL_DRIVER */
83 /**
84 * @brief CMSIS Device version number $VERSION$
86 #define __STM32G4_CMSIS_VERSION_MAIN (0x01U) /*!< [31:24] main version */
87 #define __STM32G4_CMSIS_VERSION_SUB1 (0x00U) /*!< [23:16] sub1 version */
88 #define __STM32G4_CMSIS_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */
89 #define __STM32G4_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
90 #define __STM32G4_CMSIS_VERSION ((__STM32G4_CMSIS_VERSION_MAIN << 24)\
91 |(__STM32G4_CMSIS_VERSION_SUB1 << 16)\
92 |(__STM32G4_CMSIS_VERSION_SUB2 << 8 )\
93 |(__STM32G4_CMSIS_VERSION_RC))
95 /**
96 * @}
99 /** @addtogroup Device_Included
100 * @{
103 #if defined(STM32G431xx)
104 #include "stm32g431xx.h"
105 #elif defined(STM32G441xx)
106 #include "stm32g441xx.h"
107 #elif defined(STM32G471xx)
108 #include "stm32g471xx.h"
109 #elif defined(STM32G473xx)
110 #include "stm32g473xx.h"
111 #elif defined(STM32G474xx)
112 #include "stm32g474xx.h"
113 #elif defined(STM32G484xx)
114 #include "stm32g484xx.h"
115 #elif defined(STM32GBK1CB)
116 #include "stm32gbk1cb.h"
117 #else
118 #error "Please select first the target STM32G4xx device used in your application (in stm32g4xx.h file)"
119 #endif
122 * @}
125 /** @addtogroup Exported_types
126 * @{
128 typedef enum
130 RESET = 0,
131 SET = !RESET
132 } FlagStatus, ITStatus;
134 typedef enum
136 DISABLE = 0,
137 ENABLE = !DISABLE
138 } FunctionalState;
139 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
141 typedef enum
143 SUCCESS = 0,
144 ERROR = !SUCCESS
145 } ErrorStatus;
148 * @}
152 /** @addtogroup Exported_macros
153 * @{
155 #define SET_BIT(REG, BIT) ((REG) |= (BIT))
157 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
159 #define READ_BIT(REG, BIT) ((REG) & (BIT))
161 #define CLEAR_REG(REG) ((REG) = (0x0))
163 #define WRITE_REG(REG, VAL) ((REG) = (VAL))
165 #define READ_REG(REG) ((REG))
167 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
169 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
173 * @}
176 #if defined (USE_HAL_DRIVER)
177 #include "stm32g4xx_hal.h"
178 #endif /* USE_HAL_DRIVER */
180 #ifdef __cplusplus
182 #endif /* __cplusplus */
184 #endif /* __STM32G4xx_H */
186 * @}
190 * @}
196 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/