stm32l4xx_hal_smbus_ex.h 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /**
  2. ******************************************************************************
  3. * @file stm32l4xx_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) 2017 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 STM32L4xx_HAL_SMBUS_EX_H
  20. #define STM32L4xx_HAL_SMBUS_EX_H
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* Includes ------------------------------------------------------------------*/
  25. #include "stm32l4xx_hal_def.h"
  26. /** @addtogroup STM32L4xx_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. #if defined(SYSCFG_CFGR1_I2C_PB8_FMP)
  44. #define SMBUS_FASTMODEPLUS_PB8 SYSCFG_CFGR1_I2C_PB8_FMP /*!< Enable Fast Mode Plus on PB8 */
  45. #define SMBUS_FASTMODEPLUS_PB9 SYSCFG_CFGR1_I2C_PB9_FMP /*!< Enable Fast Mode Plus on PB9 */
  46. #else
  47. #define SMBUS_FASTMODEPLUS_PB8 (uint32_t)(0x00000010U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB8 not supported */
  48. #define SMBUS_FASTMODEPLUS_PB9 (uint32_t)(0x00000012U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB9 not supported */
  49. #endif /* SYSCFG_CFGR1_I2C_PB8_FMP */
  50. #define SMBUS_FASTMODEPLUS_I2C1 SYSCFG_CFGR1_I2C1_FMP /*!< Enable Fast Mode Plus on I2C1 pins */
  51. #if defined(SYSCFG_CFGR1_I2C2_FMP)
  52. #define SMBUS_FASTMODEPLUS_I2C2 SYSCFG_CFGR1_I2C2_FMP /*!< Enable Fast Mode Plus on I2C2 pins */
  53. #else
  54. #define SMBUS_FASTMODEPLUS_I2C2 (uint32_t)(0x00000200U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C2 not supported */
  55. #endif /* SYSCFG_CFGR1_I2C2_FMP */
  56. #define SMBUS_FASTMODEPLUS_I2C3 SYSCFG_CFGR1_I2C3_FMP /*!< Enable Fast Mode Plus on I2C3 pins */
  57. #if defined(SYSCFG_CFGR1_I2C4_FMP)
  58. #define SMBUS_FASTMODEPLUS_I2C4 SYSCFG_CFGR1_I2C4_FMP /*!< Enable Fast Mode Plus on I2C4 pins */
  59. #else
  60. #define SMBUS_FASTMODEPLUS_I2C4 (uint32_t)(0x00000800U | SMBUS_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C4 not supported */
  61. #endif /* SYSCFG_CFGR1_I2C4_FMP */
  62. /**
  63. * @}
  64. */
  65. /**
  66. * @}
  67. */
  68. /* Exported macro ------------------------------------------------------------*/
  69. /** @defgroup SMBUSEx_Exported_Macros SMBUS Extended Exported Macros
  70. * @{
  71. */
  72. /**
  73. * @}
  74. */
  75. /* Exported functions --------------------------------------------------------*/
  76. /** @addtogroup SMBUSEx_Exported_Functions SMBUS Extended Exported Functions
  77. * @{
  78. */
  79. /** @addtogroup SMBUSEx_Exported_Functions_Group2 WakeUp Mode Functions
  80. * @{
  81. */
  82. /* Peripheral Control functions ************************************************/
  83. HAL_StatusTypeDef HAL_SMBUSEx_EnableWakeUp(SMBUS_HandleTypeDef *hsmbus);
  84. HAL_StatusTypeDef HAL_SMBUSEx_DisableWakeUp(SMBUS_HandleTypeDef *hsmbus);
  85. /**
  86. * @}
  87. */
  88. /** @addtogroup SMBUSEx_Exported_Functions_Group3 Fast Mode Plus Functions
  89. * @{
  90. */
  91. void HAL_SMBUSEx_EnableFastModePlus(uint32_t ConfigFastModePlus);
  92. void HAL_SMBUSEx_DisableFastModePlus(uint32_t ConfigFastModePlus);
  93. /**
  94. * @}
  95. */
  96. /**
  97. * @}
  98. */
  99. /* Private constants ---------------------------------------------------------*/
  100. /** @defgroup SMBUSEx_Private_Constants SMBUS Extended Private Constants
  101. * @{
  102. */
  103. /**
  104. * @}
  105. */
  106. /* Private macros ------------------------------------------------------------*/
  107. /** @defgroup SMBUSEx_Private_Macro SMBUS Extended Private Macros
  108. * @{
  109. */
  110. #define IS_SMBUS_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & SMBUS_FMP_NOT_SUPPORTED) != SMBUS_FMP_NOT_SUPPORTED) && \
  111. ((((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB6)) == SMBUS_FASTMODEPLUS_PB6) || \
  112. (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB7)) == SMBUS_FASTMODEPLUS_PB7) || \
  113. (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB8)) == SMBUS_FASTMODEPLUS_PB8) || \
  114. (((__CONFIG__) & (SMBUS_FASTMODEPLUS_PB9)) == SMBUS_FASTMODEPLUS_PB9) || \
  115. (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C1)) == SMBUS_FASTMODEPLUS_I2C1) || \
  116. (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C2)) == SMBUS_FASTMODEPLUS_I2C2) || \
  117. (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C3)) == SMBUS_FASTMODEPLUS_I2C3) || \
  118. (((__CONFIG__) & (SMBUS_FASTMODEPLUS_I2C4)) == SMBUS_FASTMODEPLUS_I2C4)))
  119. /**
  120. * @}
  121. */
  122. /* Private Functions ---------------------------------------------------------*/
  123. /** @defgroup SMBUSEx_Private_Functions SMBUS Extended Private Functions
  124. * @{
  125. */
  126. /* Private functions are defined in stm32l4xx_hal_smbus_ex.c file */
  127. /**
  128. * @}
  129. */
  130. /**
  131. * @}
  132. */
  133. /**
  134. * @}
  135. */
  136. #ifdef __cplusplus
  137. }
  138. #endif
  139. #endif /* STM32L4xx_HAL_SMBUS_EX_H */