| 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 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 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 | /* #define STM32G070xx */ /*!< STM32G070xx Devices */ |
|---|
| 62 | /* #define STM32G071xx */ /*!< STM32G071xx Devices */ |
|---|
| 63 | /* #define STM32G081xx */ /*!< STM32G081xx Devices */ |
|---|
| 64 | #endif |
|---|
| 65 | |
|---|
| 66 | /* Tip: To avoid modifying this file each time you need to switch between these |
|---|
| 67 | devices, you can define the device in your toolchain compiler preprocessor. |
|---|
| 68 | */ |
|---|
| 69 | #if !defined (USE_HAL_DRIVER) |
|---|
| 70 | /** |
|---|
| 71 | * @brief Comment the line below if you will not use the peripherals drivers. |
|---|
| 72 | In this case, these drivers will not be included and the application code will |
|---|
| 73 | be based on direct access to peripherals registers |
|---|
| 74 | */ |
|---|
| 75 | /*#define USE_HAL_DRIVER */ |
|---|
| 76 | #endif /* USE_HAL_DRIVER */ |
|---|
| 77 | |
|---|
| 78 | /** |
|---|
| 79 | * @brief CMSIS Device version number $VERSION$ |
|---|
| 80 | */ |
|---|
| 81 | #define __STM32G0_CMSIS_VERSION_MAIN (0x01U) /*!< [31:24] main version */ |
|---|
| 82 | #define __STM32G0_CMSIS_VERSION_SUB1 (0x01U) /*!< [23:16] sub1 version */ |
|---|
| 83 | #define __STM32G0_CMSIS_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */ |
|---|
| 84 | #define __STM32G0_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */ |
|---|
| 85 | #define __STM32G0_CMSIS_VERSION ((__STM32G0_CMSIS_VERSION_MAIN << 24)\ |
|---|
| 86 | |(__STM32G0_CMSIS_VERSION_SUB1 << 16)\ |
|---|
| 87 | |(__STM32G0_CMSIS_VERSION_SUB2 << 8 )\ |
|---|
| 88 | |(__STM32G0_CMSIS_VERSION_RC)) |
|---|
| 89 | |
|---|
| 90 | /** |
|---|
| 91 | * @} |
|---|
| 92 | */ |
|---|
| 93 | |
|---|
| 94 | /** @addtogroup Device_Included |
|---|
| 95 | * @{ |
|---|
| 96 | */ |
|---|
| 97 | |
|---|
| 98 | #if defined(STM32G071xx) |
|---|
| 99 | #include "stm32g071xx.h" |
|---|
| 100 | #elif defined(STM32G081xx) |
|---|
| 101 | #include "stm32g081xx.h" |
|---|
| 102 | #elif defined(STM32G070xx) |
|---|
| 103 | #include "stm32g070xx.h" |
|---|
| 104 | #else |
|---|
| 105 | #error "Please select first the target STM32G0xx device used in your application (in stm32g0xx.h file)" |
|---|
| 106 | #endif |
|---|
| 107 | |
|---|
| 108 | /** |
|---|
| 109 | * @} |
|---|
| 110 | */ |
|---|
| 111 | |
|---|
| 112 | /** @addtogroup Exported_types |
|---|
| 113 | * @{ |
|---|
| 114 | */ |
|---|
| 115 | typedef enum |
|---|
| 116 | { |
|---|
| 117 | RESET = 0, |
|---|
| 118 | SET = !RESET |
|---|
| 119 | } FlagStatus, ITStatus; |
|---|
| 120 | |
|---|
| 121 | typedef enum |
|---|
| 122 | { |
|---|
| 123 | DISABLE = 0, |
|---|
| 124 | ENABLE = !DISABLE |
|---|
| 125 | } FunctionalState; |
|---|
| 126 | #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) |
|---|
| 127 | |
|---|
| 128 | typedef enum |
|---|
| 129 | { |
|---|
| 130 | SUCCESS = 0, |
|---|
| 131 | ERROR = !SUCCESS |
|---|
| 132 | } ErrorStatus; |
|---|
| 133 | |
|---|
| 134 | /** |
|---|
| 135 | * @} |
|---|
| 136 | */ |
|---|
| 137 | |
|---|
| 138 | |
|---|
| 139 | /** @addtogroup Exported_macros |
|---|
| 140 | * @{ |
|---|
| 141 | */ |
|---|
| 142 | #define SET_BIT(REG, BIT) ((REG) |= (BIT)) |
|---|
| 143 | |
|---|
| 144 | #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) |
|---|
| 145 | |
|---|
| 146 | #define READ_BIT(REG, BIT) ((REG) & (BIT)) |
|---|
| 147 | |
|---|
| 148 | #define CLEAR_REG(REG) ((REG) = (0x0)) |
|---|
| 149 | |
|---|
| 150 | #define WRITE_REG(REG, VAL) ((REG) = (VAL)) |
|---|
| 151 | |
|---|
| 152 | #define READ_REG(REG) ((REG)) |
|---|
| 153 | |
|---|
| 154 | #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) |
|---|
| 155 | |
|---|
| 156 | /*#define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))*/ |
|---|
| 157 | /** |
|---|
| 158 | * @} |
|---|
| 159 | */ |
|---|
| 160 | |
|---|
| 161 | #if defined (USE_HAL_DRIVER) |
|---|
| 162 | #include "stm32g0xx_hal.h" |
|---|
| 163 | #endif /* USE_HAL_DRIVER */ |
|---|
| 164 | |
|---|
| 165 | #ifdef __cplusplus |
|---|
| 166 | } |
|---|
| 167 | #endif /* __cplusplus */ |
|---|
| 168 | |
|---|
| 169 | #endif /* STM32G0xx_H */ |
|---|
| 170 | /** |
|---|
| 171 | * @} |
|---|
| 172 | */ |
|---|
| 173 | |
|---|
| 174 | /** |
|---|
| 175 | * @} |
|---|
| 176 | */ |
|---|
| 177 | |
|---|
| 178 | |
|---|
| 179 | |
|---|
| 180 | |
|---|
| 181 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ |
|---|