Subversion Repositories DashDisplay

Rev

Rev 61 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61 Rev 65
Line 77... Line 77...
77
 
77
 
78
  /* USER CODE END MspInit 1 */
78
  /* USER CODE END MspInit 1 */
79
}
79
}
80
 
80
 
81
/**
81
/**
-
 
82
* @brief I2C MSP Initialization
-
 
83
* This function configures the hardware resources used in this example
-
 
84
* @param hi2c: I2C handle pointer
-
 
85
* @retval None
-
 
86
*/
-
 
87
void HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c)
-
 
88
{
-
 
89
  GPIO_InitTypeDef GPIO_InitStruct = {0};
-
 
90
  if(hi2c->Instance==I2C1)
-
 
91
  {
-
 
92
  /* USER CODE BEGIN I2C1_MspInit 0 */
-
 
93
 
-
 
94
  /* USER CODE END I2C1_MspInit 0 */
-
 
95
 
-
 
96
    __HAL_RCC_GPIOB_CLK_ENABLE();
-
 
97
    /**I2C1 GPIO Configuration
-
 
98
    PB6     ------> I2C1_SCL
-
 
99
    PB7     ------> I2C1_SDA
-
 
100
    */
-
 
101
    GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_7;
-
 
102
    GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
-
 
103
    GPIO_InitStruct.Pull = GPIO_PULLUP;
-
 
104
    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
-
 
105
    GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
-
 
106
    HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
-
 
107
 
-
 
108
    /* Peripheral clock enable */
-
 
109
    __HAL_RCC_I2C1_CLK_ENABLE();
-
 
110
  /* USER CODE BEGIN I2C1_MspInit 1 */
-
 
111
 
-
 
112
  /* USER CODE END I2C1_MspInit 1 */
-
 
113
  }
-
 
114
 
-
 
115
}
-
 
116
 
-
 
117
/**
-
 
118
* @brief I2C MSP De-Initialization
-
 
119
* This function freeze the hardware resources used in this example
-
 
120
* @param hi2c: I2C handle pointer
-
 
121
* @retval None
-
 
122
*/
-
 
123
void HAL_I2C_MspDeInit(I2C_HandleTypeDef* hi2c)
-
 
124
{
-
 
125
  if(hi2c->Instance==I2C1)
-
 
126
  {
-
 
127
  /* USER CODE BEGIN I2C1_MspDeInit 0 */
-
 
128
 
-
 
129
  /* USER CODE END I2C1_MspDeInit 0 */
-
 
130
    /* Peripheral clock disable */
-
 
131
    __HAL_RCC_I2C1_CLK_DISABLE();
-
 
132
 
-
 
133
    /**I2C1 GPIO Configuration
-
 
134
    PB6     ------> I2C1_SCL
-
 
135
    PB7     ------> I2C1_SDA
-
 
136
    */
-
 
137
    HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6);
-
 
138
 
-
 
139
    HAL_GPIO_DeInit(GPIOB, GPIO_PIN_7);
-
 
140
 
-
 
141
  /* USER CODE BEGIN I2C1_MspDeInit 1 */
-
 
142
 
-
 
143
  /* USER CODE END I2C1_MspDeInit 1 */
-
 
144
  }
-
 
145
 
-
 
146
}
-
 
147
 
-
 
148
/**
82
* @brief SPI MSP Initialization
149
* @brief SPI MSP Initialization
83
* This function configures the hardware resources used in this example
150
* This function configures the hardware resources used in this example
84
* @param hspi: SPI handle pointer
151
* @param hspi: SPI handle pointer
85
* @retval None
152
* @retval None
86
*/
153
*/