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.
 
 
 

168 lines
4.2 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 (0x01U) /*!< [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. #else
  80. #error "Please select first the target STM32WBxx device used in your application, for instance xxx (in stm32wbxx.h file)"
  81. #endif
  82. /**
  83. * @}
  84. */
  85. /** @addtogroup Exported_types
  86. * @{
  87. */
  88. typedef enum
  89. {
  90. RESET = 0,
  91. SET = !RESET
  92. } FlagStatus, ITStatus;
  93. typedef enum
  94. {
  95. DISABLE = 0,
  96. ENABLE = !DISABLE
  97. } FunctionalState;
  98. #define IS_FUNCTIONAL_STATE(STATE) (((STATE) == DISABLE) || ((STATE) == ENABLE))
  99. typedef enum
  100. {
  101. SUCCESS = 0,
  102. ERROR = !SUCCESS
  103. } ErrorStatus;
  104. /**
  105. * @}
  106. */
  107. /** @addtogroup Exported_macros
  108. * @{
  109. */
  110. #define SET_BIT(REG, BIT) ((REG) |= (BIT))
  111. #define CLEAR_BIT(REG, BIT) ((REG) &= ~(BIT))
  112. #define READ_BIT(REG, BIT) ((REG) & (BIT))
  113. #define CLEAR_REG(REG) ((REG) = (0x0))
  114. #define WRITE_REG(REG, VAL) ((REG) = (VAL))
  115. #define READ_REG(REG) ((REG))
  116. #define MODIFY_REG(REG, CLEARMASK, SETMASK) WRITE_REG((REG), (((READ_REG(REG)) & (~(CLEARMASK))) | (SETMASK)))
  117. #define POSITION_VAL(VAL) (__CLZ(__RBIT(VAL)))
  118. /**
  119. * @}
  120. */
  121. #if defined (USE_HAL_DRIVER)
  122. #include "stm32wbxx_hal.h"
  123. #endif /* USE_HAL_DRIVER */
  124. #ifdef __cplusplus
  125. }
  126. #endif /* __cplusplus */
  127. #endif /* __STM32WBxx_H */
  128. /**
  129. * @}
  130. */
  131. /**
  132. * @}
  133. */
  134. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/