Rev 11 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 11 | Rev 13 | ||
---|---|---|---|
Line 80... | Line 80... | ||
80 | 80 | ||
81 | /* USER CODE END MspInit 1 */ |
81 | /* USER CODE END MspInit 1 */ |
82 | } |
82 | } |
83 | 83 | ||
84 | /** |
84 | /** |
85 | * @brief CAN MSP Initialization |
- | |
86 | * This function configures the hardware resources used in this example |
- | |
87 | * @param hcan: CAN handle pointer |
- | |
88 | * @retval None |
- | |
89 | */ |
- | |
90 | void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan) |
- | |
91 | { |
- | |
92 | GPIO_InitTypeDef GPIO_InitStruct = {0}; |
- | |
93 | if(hcan->Instance==CAN1) |
- | |
94 | { |
- | |
95 | /* USER CODE BEGIN CAN1_MspInit 0 */ |
- | |
96 | - | ||
97 | /* USER CODE END CAN1_MspInit 0 */ |
- | |
98 | /* Peripheral clock enable */ |
- | |
99 | __HAL_RCC_CAN1_CLK_ENABLE(); |
- | |
100 | - | ||
101 | __HAL_RCC_GPIOA_CLK_ENABLE(); |
- | |
102 | /**CAN GPIO Configuration |
- | |
103 | PA11 ------> CAN_RX |
- | |
104 | PA12 ------> CAN_TX |
- | |
105 | */ |
- | |
106 | GPIO_InitStruct.Pin = GPIO_PIN_11; |
- | |
107 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT; |
- | |
108 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
- | |
109 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
- | |
110 | - | ||
111 | GPIO_InitStruct.Pin = GPIO_PIN_12; |
- | |
112 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; |
- | |
113 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; |
- | |
114 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
- | |
115 | - | ||
116 | /* USER CODE BEGIN CAN1_MspInit 1 */ |
- | |
117 | - | ||
118 | /* USER CODE END CAN1_MspInit 1 */ |
- | |
119 | } |
- | |
120 | - | ||
121 | } |
- | |
122 | - | ||
123 | /** |
- | |
124 | * @brief CAN MSP De-Initialization |
- | |
125 | * This function freeze the hardware resources used in this example |
- | |
126 | * @param hcan: CAN handle pointer |
- | |
127 | * @retval None |
- | |
128 | */ |
- | |
129 | void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan) |
- | |
130 | { |
- | |
131 | if(hcan->Instance==CAN1) |
- | |
132 | { |
- | |
133 | /* USER CODE BEGIN CAN1_MspDeInit 0 */ |
- | |
134 | - | ||
135 | /* USER CODE END CAN1_MspDeInit 0 */ |
- | |
136 | /* Peripheral clock disable */ |
- | |
137 | __HAL_RCC_CAN1_CLK_DISABLE(); |
- | |
138 | - | ||
139 | /**CAN GPIO Configuration |
- | |
140 | PA11 ------> CAN_RX |
- | |
141 | PA12 ------> CAN_TX |
- | |
142 | */ |
- | |
143 | HAL_GPIO_DeInit(GPIOA, GPIO_PIN_11|GPIO_PIN_12); |
- | |
144 | - | ||
145 | /* USER CODE BEGIN CAN1_MspDeInit 1 */ |
- | |
146 | - | ||
147 | /* USER CODE END CAN1_MspDeInit 1 */ |
- | |
148 | } |
- | |
149 | - | ||
150 | } |
- | |
151 | - | ||
152 | /** |
- | |
153 | * @brief I2C MSP Initialization |
85 | * @brief I2C MSP Initialization |
154 | * This function configures the hardware resources used in this example |
86 | * This function configures the hardware resources used in this example |
155 | * @param hi2c: I2C handle pointer |
87 | * @param hi2c: I2C handle pointer |
156 | * @retval None |
88 | * @retval None |
157 | */ |
89 | */ |
Line 213... | Line 145... | ||
213 | } |
145 | } |
214 | 146 | ||
215 | } |
147 | } |
216 | 148 | ||
217 | /** |
149 | /** |
- | 150 | * @brief RTC MSP Initialization |
|
- | 151 | * This function configures the hardware resources used in this example |
|
- | 152 | * @param hrtc: RTC handle pointer |
|
- | 153 | * @retval None |
|
- | 154 | */ |
|
- | 155 | void HAL_RTC_MspInit(RTC_HandleTypeDef* hrtc) |
|
- | 156 | { |
|
- | 157 | if(hrtc->Instance==RTC) |
|
- | 158 | { |
|
- | 159 | /* USER CODE BEGIN RTC_MspInit 0 */ |
|
- | 160 | ||
- | 161 | /* USER CODE END RTC_MspInit 0 */ |
|
- | 162 | HAL_PWR_EnableBkUpAccess(); |
|
- | 163 | /* Enable BKP CLK enable for backup registers */ |
|
- | 164 | __HAL_RCC_BKP_CLK_ENABLE(); |
|
- | 165 | /* Peripheral clock enable */ |
|
- | 166 | __HAL_RCC_RTC_ENABLE(); |
|
- | 167 | /* USER CODE BEGIN RTC_MspInit 1 */ |
|
- | 168 | ||
- | 169 | /* USER CODE END RTC_MspInit 1 */ |
|
- | 170 | } |
|
- | 171 | ||
- | 172 | } |
|
- | 173 | ||
- | 174 | /** |
|
- | 175 | * @brief RTC MSP De-Initialization |
|
- | 176 | * This function freeze the hardware resources used in this example |
|
- | 177 | * @param hrtc: RTC handle pointer |
|
- | 178 | * @retval None |
|
- | 179 | */ |
|
- | 180 | void HAL_RTC_MspDeInit(RTC_HandleTypeDef* hrtc) |
|
- | 181 | { |
|
- | 182 | if(hrtc->Instance==RTC) |
|
- | 183 | { |
|
- | 184 | /* USER CODE BEGIN RTC_MspDeInit 0 */ |
|
- | 185 | ||
- | 186 | /* USER CODE END RTC_MspDeInit 0 */ |
|
- | 187 | /* Peripheral clock disable */ |
|
- | 188 | __HAL_RCC_RTC_DISABLE(); |
|
- | 189 | /* USER CODE BEGIN RTC_MspDeInit 1 */ |
|
- | 190 | ||
- | 191 | /* USER CODE END RTC_MspDeInit 1 */ |
|
- | 192 | } |
|
- | 193 | ||
- | 194 | } |
|
- | 195 | ||
- | 196 | /** |
|
218 | * @brief SPI MSP Initialization |
197 | * @brief SPI MSP Initialization |
219 | * This function configures the hardware resources used in this example |
198 | * This function configures the hardware resources used in this example |
220 | * @param hspi: SPI handle pointer |
199 | * @param hspi: SPI handle pointer |
221 | * @retval None |
200 | * @retval None |
222 | */ |
201 | */ |