1 /** 2 ****************************************************************************** 3 * @file stm32wbxx.h 4 * @author MCD Application Team 5 * @brief CMSIS STM32WBxx 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 STM32WBxx 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 stm32wbxx 35 * @{ 36 */ 37 38 #ifndef __STM32WBxx_H 39 #define __STM32WBxx_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 (STM32WB) 53 #define STM32WB 54 #endif /* STM32WB */ 55 56 /* Tip: To avoid modifying this file each time you need to switch between these 57 devices, you can define the device in your toolchain compiler preprocessor. 58 */ 59 #if !defined (USE_HAL_DRIVER) 60 /** 61 * @brief Comment the line below if you will not use the peripherals drivers. 62 In this case, these drivers will not be included and the application code will 63 be based on direct access to peripherals registers 64 */ 65 /*#define USE_HAL_DRIVER */ 66 #endif /* USE_HAL_DRIVER */ 67 68 /** 69 * @brief CMSIS Device version number 70 */ 71 #define __STM32WBxx_CMSIS_VERSION_MAIN (0x01U) /*!< [31:24] main version */ 72 #define __STM32WBxx_CMSIS_VERSION_SUB1 (0x03U) /*!< [23:16] sub1 version */ 73 #define __STM32WBxx_CMSIS_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */ 74 #define __STM32WBxx_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */ 75 #define __STM32WBxx_CMSIS_DEVICE_VERSION ((__STM32WBxx_CMSIS_VERSION_MAIN << 24)\ 76 |(__STM32WBxx_CMSIS_VERSION_SUB1 << 16)\ 77 |(__STM32WBxx_CMSIS_VERSION_SUB2 << 8 )\ 78 |(__STM32WBxx_CMSIS_VERSION_RC)) 79 80 /** 81 * @} 82 */ 83 84 /** @addtogroup Device_Included 85 * @{ 86 */ 87 88 #if defined(STM32WB55xx) 89 #include "stm32wb55xx.h" 90 #elif defined(STM32WB50xx) 91 #include "stm32wb50xx.h" 92 #else 93 #error "Please select first the target STM32WBxx device used in your application, for instance xxx (in stm32wbxx.h file)" 94 #endif 95 /** 96 * @} 97 */ 98 99 /** @addtogroup Exported_types 100 * @{ 101 */ 102 typedef enum 103 { 104 RESET = 0, 105 SET = !RESET 106 } FlagStatus, ITStatus; 107 108 typedef enum 109 { 110 DISABLE = 0, 111 ENABLE = !DISABLE 112 } FunctionalState; 113 #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE)) 114 115 typedef enum 116 { 117 SUCCESS = 0, 118 ERROR = !SUCCESS 119 } ErrorStatus; 120 121 /** 122 * @} 123 */ 124 125 126 /** @addtogroup Exported_macros 127 * @{ 128 */ 129 #define SET_BIT(REG, BIT) ((REG) |= (BIT)) 130 131 #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT)) 132 133 #define READ_BIT(REG, BIT) ((REG) & (BIT)) 134 135 #define CLEAR_REG(REG) ((REG) = (0x0)) 136 137 #define WRITE_REG(REG, VAL) ((REG) = (VAL)) 138 139 #define READ_REG(REG) ((REG)) 140 141 #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK))) 142 143 #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL))) 144 /** 145 * @} 146 */ 147 148 #if defined (USE_HAL_DRIVER) 149 #include "stm32wbxx_hal.h" 150 #endif /* USE_HAL_DRIVER */ 151 152 #ifdef __cplusplus 153 } 154 #endif /* __cplusplus */ 155 156 #endif /* __STM32WBxx_H */ 157 /** 158 * @} 159 */ 160 161 /** 162 * @} 163 */ 164 165 166 167 168 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 169