[20] | 1 | /** |
---|
| 2 | ****************************************************************************** |
---|
| 3 | * @file stm32g4xx.h |
---|
| 4 | * @author MCD Application Team |
---|
| 5 | * @brief CMSIS STM32G4xx 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 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" |
---|
| 15 | * |
---|
| 16 | ****************************************************************************** |
---|
| 17 | * @attention |
---|
| 18 | * |
---|
| 19 | * <h2><center>© Copyright (c) 2019 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 | |
---|
| 30 | /** @addtogroup CMSIS |
---|
| 31 | * @{ |
---|
| 32 | */ |
---|
| 33 | |
---|
| 34 | /** @addtogroup stm32g4xx |
---|
| 35 | * @{ |
---|
| 36 | */ |
---|
| 37 | |
---|
| 38 | #ifndef __STM32G4xx_H |
---|
| 39 | #define __STM32G4xx_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 (STM32G4) |
---|
| 53 | #define STM32G4 |
---|
| 54 | #endif /* STM32G4 */ |
---|
| 55 | |
---|
| 56 | /* Uncomment the line below according to the target STM32G4 device used in your |
---|
| 57 | application |
---|
| 58 | */ |
---|
| 59 | |
---|
| 60 | #if !defined (STM32G431xx) && !defined (STM32G441xx) && !defined (STM32G471xx) && \ |
---|
| 61 | !defined (STM32G473xx) && !defined (STM32G474xx) && !defined (STM32G484xx) && \ |
---|
| 62 | !defined (STM32GBK1CB) && !defined (STM32G491xx) && !defined (STM32G4A1xx) |
---|
| 63 | /* #define STM32G431xx */ /*!< STM32G431xx Devices */ |
---|
| 64 | /* #define STM32G441xx */ /*!< STM32G441xx Devices */ |
---|
| 65 | /* #define STM32G471xx */ /*!< STM32G471xx Devices */ |
---|
| 66 | /* #define STM32G473xx */ /*!< STM32G473xx Devices */ |
---|
| 67 | /* #define STM32G483xx */ /*!< STM32G483xx Devices */ |
---|
| 68 | /* #define STM32G474xx */ /*!< STM32G474xx Devices */ |
---|
| 69 | /* #define STM32G484xx */ /*!< STM32G484xx Devices */ |
---|
| 70 | /* #define STM32G491xx */ /*!< STM32G491xx Devices */ |
---|
| 71 | /* #define STM32G4A1xx */ /*!< STM32G4A1xx Devices */ |
---|
| 72 | /* #define STM32GBK1CB */ /*!< STM32GBK1CB Devices */ |
---|
| 73 | #endif |
---|
| 74 | |
---|
| 75 | /* Tip: To avoid modifying this file each time you need to switch between these |
---|
| 76 | devices, you can define the device in your toolchain compiler preprocessor. |
---|
| 77 | */ |
---|
| 78 | #if !defined (USE_HAL_DRIVER) |
---|
| 79 | /** |
---|
| 80 | * @brief Comment the line below if you will not use the peripherals drivers. |
---|
| 81 | In this case, these drivers will not be included and the application code will |
---|
| 82 | be based on direct access to peripherals registers |
---|
| 83 | */ |
---|
| 84 | /*#define USE_HAL_DRIVER */ |
---|
| 85 | #endif /* USE_HAL_DRIVER */ |
---|
| 86 | |
---|
| 87 | /** |
---|
| 88 | * @brief CMSIS Device version number V1.2.1 |
---|
| 89 | */ |
---|
| 90 | #define __STM32G4_CMSIS_VERSION_MAIN (0x01U) /*!< [31:24] main version */ |
---|
| 91 | #define __STM32G4_CMSIS_VERSION_SUB1 (0x02U) /*!< [23:16] sub1 version */ |
---|
| 92 | #define __STM32G4_CMSIS_VERSION_SUB2 (0x01U) /*!< [15:8] sub2 version */ |
---|
| 93 | #define __STM32G4_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */ |
---|
| 94 | #define __STM32G4_CMSIS_VERSION ((__STM32G4_CMSIS_VERSION_MAIN << 24)\ |
---|
| 95 | |(__STM32G4_CMSIS_VERSION_SUB1 << 16)\ |
---|
| 96 | |(__STM32G4_CMSIS_VERSION_SUB2 << 8 )\ |
---|
| 97 | |(__STM32G4_CMSIS_VERSION_RC)) |
---|
| 98 | |
---|
| 99 | /** |
---|
| 100 | * @} |
---|
| 101 | */ |
---|
| 102 | |
---|
| 103 | /** @addtogroup Device_Included |
---|
| 104 | * @{ |
---|
| 105 | */ |
---|
| 106 | |
---|
| 107 | #if defined(STM32G431xx) |
---|
| 108 | #include "stm32g431xx.h" |
---|
| 109 | #elif defined(STM32G441xx) |
---|
| 110 | #include "stm32g441xx.h" |
---|
| 111 | #elif defined(STM32G471xx) |
---|
| 112 | #include "stm32g471xx.h" |
---|
| 113 | #elif defined(STM32G473xx) |
---|
| 114 | #include "stm32g473xx.h" |
---|
| 115 | #elif defined(STM32G483xx) |
---|
| 116 | #include "stm32g483xx.h" |
---|
| 117 | #elif defined(STM32G474xx) |
---|
| 118 | #include "stm32g474xx.h" |
---|
| 119 | #elif defined(STM32G484xx) |
---|
| 120 | #include "stm32g484xx.h" |
---|
| 121 | #elif defined(STM32G491xx) |
---|
| 122 | #include "stm32g491xx.h" |
---|
| 123 | #elif defined(STM32G4A1xx) |
---|
| 124 | #include "stm32g4a1xx.h" |
---|
| 125 | #elif defined(STM32GBK1CB) |
---|
| 126 | #include "stm32gbk1cb.h" |
---|
| 127 | #else |
---|
| 128 | #error "Please select first the target STM32G4xx device used in your application (in stm32g4xx.h file)" |
---|
| 129 | #endif |
---|
| 130 | |
---|
| 131 | /** |
---|
| 132 | * @} |
---|
| 133 | */ |
---|
| 134 | |
---|
| 135 | /** @addtogroup Exported_types |
---|
| 136 | * @{ |
---|
| 137 | */ |
---|
| 138 | typedef enum |
---|
| 139 | { |
---|
| 140 | RESET = 0, |
---|
| 141 | SET = !RESET |
---|
| 142 | } FlagStatus, ITStatus; |
---|
| 143 | |
---|
| 144 | typedef enum |
---|
| 145 | { |
---|
| 146 | DISABLE = 0, |
---|
| 147 | ENABLE = !DISABLE |
---|
| 148 | } FunctionalState; |
---|
| 149 | #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) |
---|
| 150 | |
---|
| 151 | typedef enum |
---|
| 152 | { |
---|
| 153 | SUCCESS = 0, |
---|
| 154 | ERROR = !SUCCESS |
---|
| 155 | } ErrorStatus; |
---|
| 156 | |
---|
| 157 | /** |
---|
| 158 | * @} |
---|
| 159 | */ |
---|
| 160 | |
---|
| 161 | |
---|
| 162 | /** @addtogroup Exported_macros |
---|
| 163 | * @{ |
---|
| 164 | */ |
---|
| 165 | #define SET_BIT(REG, BIT) ((REG) |= (BIT)) |
---|
| 166 | |
---|
| 167 | #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) |
---|
| 168 | |
---|
| 169 | #define READ_BIT(REG, BIT) ((REG) & (BIT)) |
---|
| 170 | |
---|
| 171 | #define CLEAR_REG(REG) ((REG) = (0x0)) |
---|
| 172 | |
---|
| 173 | #define WRITE_REG(REG, VAL) ((REG) = (VAL)) |
---|
| 174 | |
---|
| 175 | #define READ_REG(REG) ((REG)) |
---|
| 176 | |
---|
| 177 | #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) |
---|
| 178 | |
---|
| 179 | #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) |
---|
| 180 | |
---|
| 181 | |
---|
| 182 | /** |
---|
| 183 | * @} |
---|
| 184 | */ |
---|
| 185 | |
---|
| 186 | #if defined (USE_HAL_DRIVER) |
---|
| 187 | #include "stm32g4xx_hal.h" |
---|
| 188 | #endif /* USE_HAL_DRIVER */ |
---|
| 189 | |
---|
| 190 | #ifdef __cplusplus |
---|
| 191 | } |
---|
| 192 | #endif /* __cplusplus */ |
---|
| 193 | |
---|
| 194 | #endif /* __STM32G4xx_H */ |
---|
| 195 | /** |
---|
| 196 | * @} |
---|
| 197 | */ |
---|
| 198 | |
---|
| 199 | /** |
---|
| 200 | * @} |
---|
| 201 | */ |
---|
| 202 | |
---|
| 203 | |
---|
| 204 | |
---|
| 205 | |
---|
| 206 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
---|