stm32h747i_discovery_bus.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32H747I_DISCO_BUS_H
22 #define STM32H747I_DISCO_BUS_H
23 
24 #ifdef __cplusplus
25  extern "C" {
26 #endif
27 
28 
29  /* Includes ------------------------------------------------------------------*/
31 
32 #if defined(BSP_USE_CMSIS_OS)
33 #include "cmsis_os.h"
34 #endif
35 
50 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
51 typedef struct
52 {
53  void (* pMspInitCb)(I2C_HandleTypeDef *);
54  void (* pMspDeInitCb)(I2C_HandleTypeDef *);
55 }BSP_I2C_Cb_t;
56 #endif /* (USE_HAL_I2C_REGISTER_CALLBACKS == 1) */
57 
64 /* Definition for I2C4 clock resources */
65 #define BUS_I2C4 I2C4
66 #define BUS_I2C4_CLK_ENABLE() __HAL_RCC_I2C4_CLK_ENABLE()
67 #define BUS_I2C4_CLK_DISABLE() __HAL_RCC_I2C4_CLK_DISABLE()
68 #define BUS_I2C4_SCL_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
69 #define BUS_I2C4_SCL_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
70 #define BUS_I2C4_SDA_GPIO_CLK_ENABLE() __HAL_RCC_GPIOD_CLK_ENABLE()
71 #define BUS_I2C4_SDA_GPIO_CLK_DISABLE() __HAL_RCC_GPIOD_CLK_DISABLE()
72 
73 #define BUS_I2C4_FORCE_RESET() __HAL_RCC_I2C4_FORCE_RESET()
74 #define BUS_I2C4_RELEASE_RESET() __HAL_RCC_I2C4_RELEASE_RESET()
75 
76 /* Definition for I2C4 Pins */
77 #define BUS_I2C4_SCL_PIN GPIO_PIN_12
78 #define BUS_I2C4_SDA_PIN GPIO_PIN_13
79 #define BUS_I2C4_SCL_GPIO_PORT GPIOD
80 #define BUS_I2C4_SDA_GPIO_PORT GPIOD
81 #define BUS_I2C4_SCL_AF GPIO_AF4_I2C4
82 #define BUS_I2C4_SDA_AF GPIO_AF4_I2C4
83 
84 #ifndef BUS_I2C4_FREQUENCY
85  #define BUS_I2C4_FREQUENCY 100000U /* Frequency of I2Cn = 100 KHz*/
86 #endif
87 
103 int32_t BSP_I2C4_Init(void);
104 int32_t BSP_I2C4_DeInit(void);
105 int32_t BSP_I2C4_WriteReg(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length);
106 int32_t BSP_I2C4_ReadReg(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length);
107 int32_t BSP_I2C4_WriteReg16(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length);
108 int32_t BSP_I2C4_ReadReg16(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length);
109 int32_t BSP_I2C4_IsReady(uint16_t DevAddr, uint32_t Trials);
110 int32_t BSP_GetTick(void);
111 #if (USE_HAL_I2C_REGISTER_CALLBACKS == 1)
112 int32_t BSP_I2C4_RegisterDefaultMspCallbacks (void);
113 int32_t BSP_I2C4_RegisterMspCallbacks (BSP_I2C_Cb_t *Callback);
114 #endif /* USE_HAL_I2C_REGISTER_CALLBACKS */
115 HAL_StatusTypeDef MX_I2C4_Init(I2C_HandleTypeDef *phi2c, uint32_t timing);
132 #ifdef __cplusplus
133 }
134 #endif
135 
136 #endif /* STM32H747I_DISCO_BUS_H */
137 
138 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:40
BSP_I2C4_ReadReg
int32_t BSP_I2C4_ReadReg(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length)
Read a 8bit register of the device through BUS.
Definition: stm32h747i_discovery_bus.c:351
hbus_i2c4
I2C_HandleTypeDef hbus_i2c4
Definition: stm32h747i_discovery_bus.c:163
BSP_GetTick
int32_t BSP_GetTick(void)
Delay function.
Definition: stm32h747i_discovery_bus.c:483
BSP_I2C4_ReadReg16
int32_t BSP_I2C4_ReadReg16(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length)
Read a 16bit register of the device through BUS.
Definition: stm32h747i_discovery_bus.c:425
MX_I2C4_Init
__weak HAL_StatusTypeDef MX_I2C4_Init(I2C_HandleTypeDef *hI2c, uint32_t timing)
MX I2C4 initialization.
Definition: stm32h747i_discovery_bus.c:268
stm32h747i_discovery_conf.h
BSP_I2C4_WriteReg16
int32_t BSP_I2C4_WriteReg16(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length)
Write a 16bit value in a register of the device through BUS.
Definition: stm32h747i_discovery_bus.c:388
BSP_I2C4_DeInit
int32_t BSP_I2C4_DeInit(void)
DeInitializes I2C HAL.
Definition: stm32h747i_discovery_bus.c:241
BSP_I2C4_WriteReg
int32_t BSP_I2C4_WriteReg(uint16_t DevAddr, uint16_t Reg, uint8_t *pData, uint16_t Length)
Write a 8bit value in a register of the device through BUS.
Definition: stm32h747i_discovery_bus.c:314
BSP_I2C4_IsReady
int32_t BSP_I2C4_IsReady(uint16_t DevAddr, uint32_t Trials)
Checks if target device is ready for communication.
Definition: stm32h747i_discovery_bus.c:461
BSP_I2C4_Init
int32_t BSP_I2C4_Init(void)
Initializes I2C HAL.
Definition: stm32h747i_discovery_bus.c:190
I2C_HandleTypeDef
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2c.h:188


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:54