cueOS  2.4
cueOS - Universal Show Control OS for ARM
I2C_driver.c
1#include "main.h"
2
9void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
10{
11 GPIO_InitTypeDef GPIO_InitStruct = {0};
12 if(hi2c->Instance==I2C3)
13 {
14 /* USER CODE BEGIN I2C3_MspInit 0 */
15
16 /* USER CODE END I2C3_MspInit 0 */
17
18 __HAL_RCC_GPIOC_CLK_ENABLE();
19 __HAL_RCC_GPIOA_CLK_ENABLE();
24 GPIO_InitStruct.Pin = GPIO_PIN_9;
25 GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
26 GPIO_InitStruct.Pull = GPIO_PULLUP;
27 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
28 GPIO_InitStruct.Alternate = GPIO_AF4_I2C3;
29 HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
30
31 GPIO_InitStruct.Pin = GPIO_PIN_8;
32 GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
33 GPIO_InitStruct.Pull = GPIO_PULLUP;
34 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
35 GPIO_InitStruct.Alternate = GPIO_AF4_I2C3;
36 HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
37
38 /* Peripheral clock enable */
39 __HAL_RCC_I2C3_CLK_ENABLE();
40// /* I2C3 interrupt Init */
41// HAL_NVIC_SetPriority(I2C3_EV_IRQn, 5, 0);
42// HAL_NVIC_EnableIRQ(I2C3_EV_IRQn);
43 /* USER CODE BEGIN I2C3_MspInit 1 */
44
45 /* USER CODE END I2C3_MspInit 1 */
46 }
47
48}