1 /** 2 ****************************************************************************** 3 * @file stm32wb0x_hal.h 4 * @author MCD Application Team 5 * @brief This file contains all the functions prototypes for the HAL 6 * module driver. 7 ****************************************************************************** 8 * @attention 9 * 10 * Copyright (c) 2024 STMicroelectronics. 11 * All rights reserved. 12 * 13 * This software is licensed under terms that can be found in the LICENSE file 14 * in the root directory of this software component. 15 * If no LICENSE file comes with this software, it is provided AS-IS. 16 * 17 ****************************************************************************** 18 */ 19 20 /* Define to prevent recursive inclusion -------------------------------------*/ 21 #ifndef STM32WB0x_HAL_H 22 #define STM32WB0x_HAL_H 23 24 #ifdef __cplusplus 25 extern "C" { 26 #endif 27 28 /* Includes ------------------------------------------------------------------*/ 29 #include "stm32wb0x_hal_conf.h" 30 #include "stm32wb0x_ll_system.h" 31 32 /** @addtogroup STM32WB0x_HAL_Driver 33 * @{ 34 */ 35 36 /** @defgroup HAL HAL 37 * @{ 38 */ 39 40 /* Exported constants --------------------------------------------------------*/ 41 /** @defgroup HAL_Exported_Constants HAL Exported Constants 42 * @{ 43 */ 44 /** @defgroup HAL_Private_Constants HAL Private Constants 45 * @{ 46 */ 47 /** 48 * @brief HAL Driver version number 49 */ 50 #define __STM32WB0x_HAL_VERSION_MAIN (0x01U) /*!< [31:24] main version */ 51 #define __STM32WB0x_HAL_VERSION_SUB1 (0x00U) /*!< [23:16] sub1 version */ 52 #define __STM32WB0x_HAL_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */ 53 #define __STM32WB0x_HAL_VERSION_RC (0x00U) /*!< [7:0] release candidate */ 54 #define __STM32WB0x_HAL_VERSION ((__STM32WB0x_HAL_VERSION_MAIN << 24U)\ 55 |(__STM32WB0x_HAL_VERSION_SUB1 << 16U)\ 56 |(__STM32WB0x_HAL_VERSION_SUB2 << 8U )\ 57 |(__STM32WB0x_HAL_VERSION_RC)) 58 /** 59 * @} 60 */ 61 62 63 /** @defgroup HAL_TICK_FREQ Tick Frequency 64 * @{ 65 */ 66 typedef enum 67 { 68 HAL_TICK_FREQ_10HZ = 100U, 69 HAL_TICK_FREQ_100HZ = 10U, 70 HAL_TICK_FREQ_1KHZ = 1U, 71 HAL_TICK_FREQ_DEFAULT = HAL_TICK_FREQ_1KHZ 72 } HAL_TickFreqTypeDef; 73 74 /** 75 * @} 76 */ 77 78 79 /** @defgroup SYSCFG_Exported_Constants SYSCFG Exported Constants 80 * @{ 81 */ 82 83 /** @defgroup SYSCFG_BootMode BOOT Mode 84 * @{ 85 */ 86 #define SYSCFG_BOOT_MAINFLASH LL_SYSCFG_REMAP_FLASH /*!< Main Flash memory mapped at 0x00000000 */ 87 #define SYSCFG_BOOT_SRAM LL_SYSCFG_REMAP_SRAM /*!< SRAM1 mapped at 0x00000000 */ 88 89 /** 90 * @} 91 */ 92 93 /** @defgroup SYSCFG_FastModePlus_GPIO Fast-mode Plus on GPIO 94 * @{ 95 */ 96 97 /** @brief Fast-mode Plus driving capability on a specific GPIO 98 */ 99 #if defined(I2C1) 100 #define SYSCFG_FASTMODEPLUS_PA0 SYSCFG_I2C_FMP_CTRL_I2C1_PA0_FMP /*!< Enable Fast-mode Plus on PA0 */ 101 #define SYSCFG_FASTMODEPLUS_PA1 SYSCFG_I2C_FMP_CTRL_I2C1_PA1_FMP /*!< Enable Fast Mode Plus on PA1 */ 102 #if defined (STM32WB09) || defined (STM32WB05) 103 #define SYSCFG_FASTMODEPLUS_PB6 SYSCFG_I2C_FMP_CTRL_I2C1_PB6_FMP /*!< Enable Fast-mode Plus on PB6 */ 104 #define SYSCFG_FASTMODEPLUS_PB7 SYSCFG_I2C_FMP_CTRL_I2C1_PB7_FMP /*!< Enable Fast-mode Plus on PB7 */ 105 #endif 106 #endif /* I2C1 */ 107 #if defined(I2C2) 108 #define SYSCFG_FASTMODEPLUS_PB6 SYSCFG_I2C_FMP_CTRL_I2C2_PB6_FMP /*!< Enable Fast Mode Plus on PB6 */ 109 #define SYSCFG_FASTMODEPLUS_PB7 SYSCFG_I2C_FMP_CTRL_I2C2_PB7_FMP /*!< Enable Fast Mode Plus on PB7 */ 110 #endif /* I2C2 */ 111 112 /** 113 * @} 114 */ 115 116 /** 117 * @} 118 */ 119 120 /** 121 * @} 122 */ 123 124 /* Exported macros -----------------------------------------------------------*/ 125 /** @defgroup HAL_Exported_Macros HAL Exported Macros 126 * @{ 127 */ 128 129 /** @brief Main Flash memory mapped at 0x00000000 130 */ 131 #define __HAL_SYSCFG_REMAPMEMORY_FLASH() LL_SYSCFG_SetRemapMemory(LL_SYSCFG_REMAP_FLASH) 132 133 /** @brief Embedded SRAM mapped at 0x00000000 134 */ 135 #define __HAL_SYSCFG_REMAPMEMORY_SRAM() LL_SYSCFG_SetRemapMemory(LL_SYSCFG_REMAP_SRAM) 136 137 138 /** 139 * @brief Return the boot mode as configured by user. 140 * @retval The boot mode as configured by user. The returned value can be one 141 * of the following values: 142 * @arg @ref SYSCFG_BOOT_MAINFLASH 143 * @arg @ref SYSCFG_BOOT_SRAM 144 */ 145 #define __HAL_SYSCFG_GET_BOOT_MODE() LL_SYSCFG_GetRemapMemory() 146 147 148 /** @brief Fast mode Plus driving capability enable/disable macros 149 * @param __FASTMODEPLUS__ This parameter can be a value of @ref SYSCFG_FastModePlus_GPIO 150 */ 151 #define __HAL_SYSCFG_FASTMODEPLUS_ENABLE(__FASTMODEPLUS__) do {assert_param(IS_SYSCFG_FASTMODEPLUS((__FASTMODEPLUS__))); \ 152 LL_SYSCFG_EnableFastModePlus(__FASTMODEPLUS__); \ 153 }while(0) 154 155 #define __HAL_SYSCFG_FASTMODEPLUS_DISABLE(__FASTMODEPLUS__) do {assert_param(IS_SYSCFG_FASTMODEPLUS((__FASTMODEPLUS__))); \ 156 LL_SYSCFG_DisableFastModePlus(__FASTMODEPLUS__); \ 157 }while(0) 158 159 /** 160 * @} 161 */ 162 163 164 /* Private macros ------------------------------------------------------------*/ 165 /** @defgroup HAL_Private_Macros HAL Private Macros 166 * @{ 167 */ 168 169 /** @defgroup SYSCFG_Private_Macros SYSCFG Private Macros 170 * @{ 171 */ 172 173 #define IS_SYSCFG_FASTMODEPLUS(__PIN__) ((((__PIN__) & SYSCFG_FASTMODEPLUS_PA0) == SYSCFG_FASTMODEPLUS_PA0) || \ 174 (((__PIN__) & SYSCFG_FASTMODEPLUS_PA1) == SYSCFG_FASTMODEPLUS_PA1) || \ 175 (((__PIN__) & SYSCFG_FASTMODEPLUS_PB6) == SYSCFG_FASTMODEPLUS_PB6) || \ 176 (((__PIN__) & SYSCFG_FASTMODEPLUS_PB7) == SYSCFG_FASTMODEPLUS_PB7)) 177 178 /** 179 * @} 180 */ 181 182 /** 183 * @} 184 */ 185 186 /** @defgroup HAL_Private_Macros HAL Private Macros 187 * @{ 188 */ 189 #define IS_TICKFREQ(FREQ) (((FREQ) == HAL_TICK_FREQ_10HZ) || \ 190 ((FREQ) == HAL_TICK_FREQ_100HZ) || \ 191 ((FREQ) == HAL_TICK_FREQ_1KHZ)) 192 /** 193 * @} 194 */ 195 196 197 /* Exported functions --------------------------------------------------------*/ 198 199 /** @defgroup HAL_Exported_Functions HAL Exported Functions 200 * @{ 201 */ 202 203 /** @defgroup HAL_Exported_Functions_Group1 HAL Initialization and Configuration functions 204 * @{ 205 */ 206 207 /* Initialization and Configuration functions ******************************/ 208 HAL_StatusTypeDef HAL_Init(void); 209 HAL_StatusTypeDef HAL_DeInit(void); 210 void HAL_MspInit(void); 211 void HAL_MspDeInit(void); 212 213 HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority); 214 215 /** 216 * @} 217 */ 218 219 /** @defgroup HAL_Exported_Functions_Group2 HAL Control functions 220 * @{ 221 */ 222 223 /* Peripheral Control functions ************************************************/ 224 void HAL_IncTick(void); 225 void HAL_Delay(uint32_t Delay); 226 uint32_t HAL_GetTick(void); 227 uint32_t HAL_GetTickPrio(void); 228 HAL_StatusTypeDef HAL_SetTickFreq(HAL_TickFreqTypeDef Freq); 229 HAL_TickFreqTypeDef HAL_GetTickFreq(void); 230 void HAL_SuspendTick(void); 231 void HAL_ResumeTick(void); 232 uint32_t HAL_GetHalVersion(void); 233 uint32_t HAL_GetREVID(void); 234 uint32_t HAL_GetVERID(void); 235 uint32_t HAL_GetDEVID(void); 236 uint32_t HAL_GetJTAGID(void); 237 uint32_t HAL_GetUIDw0(void); 238 uint32_t HAL_GetUIDw1(void); 239 uint32_t HAL_GetUIDw2(void); 240 241 /** 242 * @} 243 */ 244 245 /* Exported variables ---------------------------------------------------------*/ 246 /** @addtogroup HAL_Exported_Variables 247 * @{ 248 */ 249 extern __IO uint32_t uwTick; 250 extern uint32_t uwTickPrio; 251 extern HAL_TickFreqTypeDef uwTickFreq; 252 /** 253 * @} 254 */ 255 256 /** 257 * @} 258 */ 259 260 /** 261 * @} 262 */ 263 264 /** 265 * @} 266 */ 267 268 #ifdef __cplusplus 269 } 270 #endif 271 272 #endif /* STM32WB0x_HAL_H */ 273