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>© 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 | |
---|
30 | /** @addtogroup CMSIS |
---|
31 | * @{ |
---|
32 | */ |
---|
33 | |
---|
34 | /** @addtogroup stm32g0xx |
---|
35 | * @{ |
---|
36 | */ |
---|
37 | |
---|
38 | #ifndef STM32G0xx_H |
---|
39 | #define STM32G0xx_H |
---|
40 | |
---|
41 | #ifdef __cplusplus |
---|
42 | extern "C" { |
---|
43 | #endif /* __cplusplus */ |
---|
44 | |
---|
45 | /** @addtogroup Library_configuration_section |
---|
46 | * @{ |
---|
47 | */ |
---|
48 | |
---|
49 | /** |
---|
50 | * @brief STM32 Family |
---|
51 | */ |
---|
52 | #if !defined (STM32G0) |
---|
53 | #define STM32G0 |
---|
54 | #endif /* STM32G0 */ |
---|
55 | |
---|
56 | /* Uncomment the line below according to the target STM32G0 device used in your |
---|
57 | application |
---|
58 | */ |
---|
59 | |
---|
60 | #if !defined (STM32G071xx) && !defined (STM32G081xx) && !defined (STM32G070xx) \ |
---|
61 | && !defined (STM32G030xx) && !defined (STM32G031xx) && !defined (STM32G041xx) \ |
---|
62 | && !defined (STM32G0B0xx) && !defined (STM32G0B1xx) && !defined (STM32G0C1xx) \ |
---|
63 | && !defined (STM32G050xx) && !defined (STM32G051xx) && !defined (STM32G061xx) |
---|
64 | /* #define STM32G0B0xx */ /*!< STM32G0B0xx Devices */ |
---|
65 | /* #define STM32G0B1xx */ /*!< STM32G0B1xx Devices */ |
---|
66 | /* #define STM32G0C1xx */ /*!< STM32G0C1xx Devices */ |
---|
67 | /* #define STM32G070xx */ /*!< STM32G070xx Devices */ |
---|
68 | /* #define STM32G071xx */ /*!< STM32G071xx Devices */ |
---|
69 | /* #define STM32G081xx */ /*!< STM32G081xx Devices */ |
---|
70 | /* #define STM32G050xx */ /*!< STM32G050xx Devices */ |
---|
71 | /* #define STM32G051xx */ /*!< STM32G051xx Devices */ |
---|
72 | /* #define STM32G061xx */ /*!< STM32G061xx Devices */ |
---|
73 | /* #define STM32G030xx */ /*!< STM32G030xx Devices */ |
---|
74 | /* #define STM32G031xx */ /*!< STM32G031xx Devices */ |
---|
75 | /* #define STM32G041xx */ /*!< STM32G041xx Devices */ |
---|
76 | #endif |
---|
77 | |
---|
78 | /* Tip: To avoid modifying this file each time you need to switch between these |
---|
79 | devices, you can define the device in your toolchain compiler preprocessor. |
---|
80 | */ |
---|
81 | #if !defined (USE_HAL_DRIVER) |
---|
82 | /** |
---|
83 | * @brief Comment the line below if you will not use the peripherals drivers. |
---|
84 | In this case, these drivers will not be included and the application code will |
---|
85 | be based on direct access to peripherals registers |
---|
86 | */ |
---|
87 | /*#define USE_HAL_DRIVER */ |
---|
88 | #endif /* USE_HAL_DRIVER */ |
---|
89 | |
---|
90 | /** |
---|
91 | * @brief CMSIS Device version number $VERSION$ |
---|
92 | */ |
---|
93 | #define __STM32G0_CMSIS_VERSION_MAIN (0x01U) /*!< [31:24] main version */ |
---|
94 | #define __STM32G0_CMSIS_VERSION_SUB1 (0x04U) /*!< [23:16] sub1 version */ |
---|
95 | #define __STM32G0_CMSIS_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */ |
---|
96 | #define __STM32G0_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */ |
---|
97 | #define __STM32G0_CMSIS_VERSION ((__STM32G0_CMSIS_VERSION_MAIN << 24)\ |
---|
98 | |(__STM32G0_CMSIS_VERSION_SUB1 << 16)\ |
---|
99 | |(__STM32G0_CMSIS_VERSION_SUB2 << 8 )\ |
---|
100 | |(__STM32G0_CMSIS_VERSION_RC)) |
---|
101 | |
---|
102 | /** |
---|
103 | * @} |
---|
104 | */ |
---|
105 | |
---|
106 | /** @addtogroup Device_Included |
---|
107 | * @{ |
---|
108 | */ |
---|
109 | |
---|
110 | #if defined(STM32G0B1xx) |
---|
111 | #include "stm32g0b1xx.h" |
---|
112 | #elif defined(STM32G0C1xx) |
---|
113 | #include "stm32g0c1xx.h" |
---|
114 | #elif defined(STM32G0B0xx) |
---|
115 | #include "stm32g0b0xx.h" |
---|
116 | #elif defined(STM32G071xx) |
---|
117 | #include "stm32g071xx.h" |
---|
118 | #elif defined(STM32G081xx) |
---|
119 | #include "stm32g081xx.h" |
---|
120 | #elif defined(STM32G070xx) |
---|
121 | #include "stm32g070xx.h" |
---|
122 | #elif defined(STM32G031xx) |
---|
123 | #include "stm32g031xx.h" |
---|
124 | #elif defined(STM32G041xx) |
---|
125 | #include "stm32g041xx.h" |
---|
126 | #elif defined(STM32G030xx) |
---|
127 | #include "stm32g030xx.h" |
---|
128 | #elif defined(STM32G051xx) |
---|
129 | #include "stm32g051xx.h" |
---|
130 | #elif defined(STM32G061xx) |
---|
131 | #include "stm32g061xx.h" |
---|
132 | #elif defined(STM32G050xx) |
---|
133 | #include "stm32g050xx.h" |
---|
134 | #else |
---|
135 | #error "Please select first the target STM32G0xx device used in your application (in stm32g0xx.h file)" |
---|
136 | #endif |
---|
137 | |
---|
138 | /** |
---|
139 | * @} |
---|
140 | */ |
---|
141 | |
---|
142 | /** @addtogroup Exported_types |
---|
143 | * @{ |
---|
144 | */ |
---|
145 | typedef enum |
---|
146 | { |
---|
147 | RESET = 0, |
---|
148 | SET = !RESET |
---|
149 | } FlagStatus, ITStatus; |
---|
150 | |
---|
151 | typedef enum |
---|
152 | { |
---|
153 | DISABLE = 0, |
---|
154 | ENABLE = !DISABLE |
---|
155 | } FunctionalState; |
---|
156 | #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) |
---|
157 | |
---|
158 | typedef enum |
---|
159 | { |
---|
160 | SUCCESS = 0, |
---|
161 | ERROR = !SUCCESS |
---|
162 | } ErrorStatus; |
---|
163 | |
---|
164 | /** |
---|
165 | * @} |
---|
166 | */ |
---|
167 | |
---|
168 | |
---|
169 | /** @addtogroup Exported_macros |
---|
170 | * @{ |
---|
171 | */ |
---|
172 | #define SET_BIT(REG, BIT) ((REG) |= (BIT)) |
---|
173 | |
---|
174 | #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) |
---|
175 | |
---|
176 | #define READ_BIT(REG, BIT) ((REG) & (BIT)) |
---|
177 | |
---|
178 | #define CLEAR_REG(REG) ((REG) = (0x0)) |
---|
179 | |
---|
180 | #define WRITE_REG(REG, VAL) ((REG) = (VAL)) |
---|
181 | |
---|
182 | #define READ_REG(REG) ((REG)) |
---|
183 | |
---|
184 | #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) |
---|
185 | |
---|
186 | /*#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))*/ |
---|
187 | /** |
---|
188 | * @} |
---|
189 | */ |
---|
190 | |
---|
191 | #if defined (USE_HAL_DRIVER) |
---|
192 | #include "stm32g0xx_hal.h" |
---|
193 | #endif /* USE_HAL_DRIVER */ |
---|
194 | |
---|
195 | #ifdef __cplusplus |
---|
196 | } |
---|
197 | #endif /* __cplusplus */ |
---|
198 | |
---|
199 | #endif /* STM32G0xx_H */ |
---|
200 | /** |
---|
201 | * @} |
---|
202 | */ |
---|
203 | |
---|
204 | /** |
---|
205 | * @} |
---|
206 | */ |
---|
207 | |
---|
208 | |
---|
209 | |
---|
210 | |
---|
211 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
---|