stm32g4xx_hal_smbus_ex.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /**
  2. ******************************************************************************
  3. * @file stm32g4xx_hal_smbus_ex.h
  4. * @author MCD Application Team
  5. * @brief Header file of SMBUS HAL Extended module.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * Copyright (c) 2019 STMicroelectronics.
  10. * All rights reserved.
  11. *
  12. * This software is licensed under terms that can be found in the LICENSE file
  13. * in the root directory of this software component.
  14. * If no LICENSE file comes with this software, it is provided AS-IS.
  15. *
  16. ******************************************************************************
  17. */
  18. /* Define to prevent recursive inclusion -------------------------------------*/
  19. #ifndef STM32G4xx_HAL_SMBUS_EX_H
  20. #define STM32G4xx_HAL_SMBUS_EX_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32g4xx_hal_def.h"
  26. /** @addtogroup STM32G4xx_HAL_Driver
  27. * @{
  28. */
  29. /** @addtogroup SMBUSEx
  30. * @{
  31. */
  32. /* Exported types ------------------------------------------------------------*/
  33. /* Exported constants --------------------------------------------------------*/
  34. /** @defgroup SMBUSEx_Exported_Constants SMBUS Extended Exported Constants
  35. * @{
  36. */
  37. /** @defgroup SMBUSEx_FastModePlus SMBUS Extended Fast Mode Plus
  38. * @{
  39. */
  40. #define SMBUS_FMP_NOT_SUPPORTED 0xAAAA0000U /*!< Fast Mode Plus not supported */
  41. #define SMBUS_FASTMODEPLUS_PB6 SYSCFG_CFGR1_I2C_PB6_FMP /*!< Enable Fast Mode Plus on PB6 */
  42. #define SMBUS_FASTMODEPLUS_PB7 SYSCFG_CFGR1_I2C_PB7_FMP /*!< Enable Fast Mode Plus on PB7 */
  43. #define SMBUS_FASTMODEPLUS_PB8 SYSCFG_CFGR1_I2C_PB8_FMP /*!< Enable Fast Mode Plus on PB8 */
  44. #define SMBUS_FASTMODEPLUS_PB9 SYSCFG_CFGR1_I2C_PB9_FMP /*!< Enable Fast Mode Plus on PB9 */
  45. #define SMBUS_FASTMODEPLUS_I2C1 SYSCFG_CFGR1_I2C1_FMP /*!< Enable Fast Mode Plus on I2C1 pins */
  46. #define SMBUS_FASTMODEPLUS_I2C2 SYSCFG_CFGR1_I2C2_FMP /*!< Enable Fast Mode Plus on I2C2 pins */
  47. #if defined(SYSCFG_CFGR1_I2C3_FMP)
  48. #define SMBUS_FASTMODEPLUS_I2C3 SYSCFG_CFGR1_I2C3_FMP /*!< Enable Fast Mode Plus on I2C3 pins */
  49. #else
  50. #define SMBUS_FASTMODEPLUS_I2C3 (uint32_t)(0x00000400U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C3 not supported */
  51. #endif /* SYSCFG_CFGR1_I2C3_FMP */
  52. #if defined(SYSCFG_CFGR1_I2C4_FMP)
  53. #define SMBUS_FASTMODEPLUS_I2C4 SYSCFG_CFGR1_I2C4_FMP /*!< Enable Fast Mode Plus on I2C4 pins */
  54. #else
  55. #define SMBUS_FASTMODEPLUS_I2C4 (uint32_t)(0x00000800U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C4 not supported */
  56. #endif /* SYSCFG_CFGR1_I2C4_FMP */
  57. /**
  58. * @}
  59. */
  60. /**
  61. * @}
  62. */
  63. /* Exported macro ------------------------------------------------------------*/
  64. /** @defgroup SMBUSEx_Exported_Macros SMBUS Extended Exported Macros
  65. * @{
  66. */
  67. /**
  68. * @}
  69. */
  70. /* Exported functions --------------------------------------------------------*/
  71. /** @addtogroup SMBUSEx_Exported_Functions SMBUS Extended Exported Functions
  72. * @{
  73. */
  74. /** @addtogroup SMBUSEx_Exported_Functions_Group2 WakeUp Mode Functions
  75. * @{
  76. */
  77. /* Peripheral Control functions ************************************************/
  78. HAL_StatusTypeDef HAL_SMBUSEx_EnableWakeUp(SMBUS_HandleTypeDef *hsmbus);
  79. HAL_StatusTypeDef HAL_SMBUSEx_DisableWakeUp(SMBUS_HandleTypeDef *hsmbus);
  80. /**
  81. * @}
  82. */
  83. /** @addtogroup SMBUSEx_Exported_Functions_Group3 Fast Mode Plus Functions
  84. * @{
  85. */
  86. void HAL_SMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus);
  87. void HAL_SMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus);
  88. /**
  89. * @}
  90. */
  91. /**
  92. * @}
  93. */
  94. /* Private constants ---------------------------------------------------------*/
  95. /** @defgroup SMBUSEx_Private_Constants SMBUS Extended Private Constants
  96. * @{
  97. */
  98. /**
  99. * @}
  100. */
  101. /* Private macros ------------------------------------------------------------*/
  102. /** @defgroup SMBUSEx_Private_Macro SMBUS Extended Private Macros
  103. * @{
  104. */
  105. #define IS_SMBUS_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & SMBUS_FMP_NOT_SUPPORTED) != SMBUS_FMP_NOT_SUPPORTED) && \
  106. ((((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB6)) == SMBUS_FASTMODEPLUS_PB6) || \
  107. (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB7)) == SMBUS_FASTMODEPLUS_PB7) || \
  108. (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB8)) == SMBUS_FASTMODEPLUS_PB8) || \
  109. (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB9)) == SMBUS_FASTMODEPLUS_PB9) || \
  110. (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C1)) == SMBUS_FASTMODEPLUS_I2C1) || \
  111. (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C2)) == SMBUS_FASTMODEPLUS_I2C2) || \
  112. (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C3)) == SMBUS_FASTMODEPLUS_I2C3) || \
  113. (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C4)) == SMBUS_FASTMODEPLUS_I2C4)))
  114. /**
  115. * @}
  116. */
  117. /* Private Functions ---------------------------------------------------------*/
  118. /** @defgroup SMBUSEx_Private_Functions SMBUS Extended Private Functions
  119. * @{
  120. */
  121. /* Private functions are defined in stm32g4xx_hal_smbus_ex.c file */
  122. /**
  123. * @}
  124. */
  125. /**
  126. * @}
  127. */
  128. /**
  129. * @}
  130. */
  131. #ifdef __cplusplus
  132. }
  133. #endif
  134. #endif /* STM32G4xx_HAL_SMBUS_EX_H */