stm32l0xx_hal_smbus_ex.h 6.7 KB

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