You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

175 lines
4.4 KiB

  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>&copy; 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. /** @addtogroup CMSIS
  30. * @{
  31. */
  32. /** @addtogroup stm32wbxx
  33. * @{
  34. */
  35. #ifndef __STM32WBxx_H
  36. #define __STM32WBxx_H
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif /* __cplusplus */
  40. /** @addtogroup Library_configuration_section
  41. * @{
  42. */
  43. /**
  44. * @brief STM32 Family
  45. */
  46. #if !defined (STM32WB)
  47. #define STM32WB
  48. #endif /* STM32WB */
  49. /* Tip: To avoid modifying this file each time you need to switch between these
  50. devices, you can define the device in your toolchain compiler preprocessor.
  51. */
  52. #if !defined (USE_HAL_DRIVER)
  53. /**
  54. * @brief Comment the line below if you will not use the peripherals drivers.
  55. In this case, these drivers will not be included and the application code will
  56. be based on direct access to peripherals registers
  57. */
  58. /*#define USE_HAL_DRIVER */
  59. #endif /* USE_HAL_DRIVER */
  60. /**
  61. * @brief CMSIS Device version number
  62. */
  63. #define __STM32WBxx_CMSIS_VERSION_MAIN (0x01U) /*!< [31:24] main version */
  64. #define __STM32WBxx_CMSIS_VERSION_SUB1 (0x04U) /*!< [23:16] sub1 version */
  65. #define __STM32WBxx_CMSIS_VERSION_SUB2 (0x00U) /*!< [15:8] sub2 version */
  66. #define __STM32WBxx_CMSIS_VERSION_RC (0x00U) /*!< [7:0] release candidate */
  67. #define __STM32WBxx_CMSIS_DEVICE_VERSION ((__STM32WBxx_CMSIS_VERSION_MAIN << 24)\
  68. |(__STM32WBxx_CMSIS_VERSION_SUB1 << 16)\
  69. |(__STM32WBxx_CMSIS_VERSION_SUB2 << 8 )\
  70. |(__STM32WBxx_CMSIS_VERSION_RC))
  71. /**
  72. * @}
  73. */
  74. /** @addtogroup Device_Included
  75. * @{
  76. */
  77. #if defined(STM32WB55xx)
  78. #include "stm32wb55xx.h"
  79. #elif defined(STM32WB5Mxx)
  80. #include "stm32wb5mxx.h"
  81. #elif defined(STM32WB50xx)
  82. #include "stm32wb50xx.h"
  83. #elif defined(STM32WB35xx)
  84. #include "stm32wb35xx.h"
  85. #elif defined(STM32WB30xx)
  86. #include "stm32wb30xx.h"
  87. #else
  88. #error "Please select first the target STM32WBxx device used in your application, for instance xxx (in stm32wbxx.h file)"
  89. #endif
  90. /**
  91. * @}
  92. */
  93. /** @addtogroup Exported_types
  94. * @{
  95. */
  96. typedef enum
  97. {
  98. RESET = 0,
  99. SET = !RESET
  100. } FlagStatus, ITStatus;
  101. typedef enum
  102. {
  103. DISABLE = 0,
  104. ENABLE = !DISABLE
  105. } FunctionalState;
  106. #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
  107. typedef enum
  108. {
  109. SUCCESS = 0,
  110. ERROR = !SUCCESS
  111. } ErrorStatus;
  112. /**
  113. * @}
  114. */
  115. /** @addtogroup Exported_macros
  116. * @{
  117. */
  118. #define SET_BIT(REG, BIT) ((REG) |= (BIT))
  119. #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
  120. #define READ_BIT(REG, BIT) ((REG) & (BIT))
  121. #define CLEAR_REG(REG) ((REG) = (0x0))
  122. #define WRITE_REG(REG, VAL) ((REG) = (VAL))
  123. #define READ_REG(REG) ((REG))
  124. #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
  125. #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
  126. /**
  127. * @}
  128. */
  129. #if defined (USE_HAL_DRIVER)
  130. #include "stm32wbxx_hal.h"
  131. #endif /* USE_HAL_DRIVER */
  132. #ifdef __cplusplus
  133. }
  134. #endif /* __cplusplus */
  135. #endif /* __STM32WBxx_H */
  136. /**
  137. * @}
  138. */
  139. /**
  140. * @}
  141. */
  142. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/