Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 5 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /** |
1 | /** |
| 2 | ****************************************************************************** |
2 | ****************************************************************************** |
| 3 | * @file stm32f1xx_hal_can.c |
3 | * @file stm32f1xx_hal_can.c |
| 4 | * @author MCD Application Team |
4 | * @author MCD Application Team |
| 5 | * @version V1.0.1 |
5 | * @version V1.0.4 |
| 6 | * @date 31-July-2015 |
6 | * @date 29-April-2016 |
| 7 | * @brief CAN HAL module driver. |
7 | * @brief CAN HAL module driver. |
| 8 | * This file provides firmware functions to manage the following |
8 | * This file provides firmware functions to manage the following |
| 9 | * functionalities of the Controller Area Network (CAN) peripheral: |
9 | * functionalities of the Controller Area Network (CAN) peripheral: |
| 10 | * + Initialization and de-initialization functions |
10 | * + Initialization and de-initialization functions |
| 11 | * + IO operation functions |
11 | * + IO operation functions |
| Line 71... | Line 71... | ||
| 71 | @endverbatim |
71 | @endverbatim |
| 72 | |
72 | |
| 73 | ****************************************************************************** |
73 | ****************************************************************************** |
| 74 | * @attention |
74 | * @attention |
| 75 | * |
75 | * |
| 76 | * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> |
76 | * <h2><center>© COPYRIGHT(c) 2016 STMicroelectronics</center></h2> |
| 77 | * |
77 | * |
| 78 | * Redistribution and use in source and binary forms, with or without modification, |
78 | * Redistribution and use in source and binary forms, with or without modification, |
| 79 | * are permitted provided that the following conditions are met: |
79 | * are permitted provided that the following conditions are met: |
| 80 | * 1. Redistributions of source code must retain the above copyright notice, |
80 | * 1. Redistributions of source code must retain the above copyright notice, |
| 81 | * this list of conditions and the following disclaimer. |
81 | * this list of conditions and the following disclaimer. |
| Line 474... | Line 474... | ||
| 474 | * the configuration information for the specified CAN. |
474 | * the configuration information for the specified CAN. |
| 475 | * @retval None |
475 | * @retval None |
| 476 | */ |
476 | */ |
| 477 | __weak void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan) |
477 | __weak void HAL_CAN_MspInit(CAN_HandleTypeDef* hcan) |
| 478 | { |
478 | { |
| - | 479 | /* Prevent unused argument(s) compilation warning */ |
|
| - | 480 | UNUSED(hcan); |
|
| 479 | /* NOTE : This function Should not be modified, when the callback is needed, |
481 | /* NOTE : This function Should not be modified, when the callback is needed, |
| 480 | the HAL_CAN_MspInit can be implemented in the user file |
482 | the HAL_CAN_MspInit can be implemented in the user file |
| 481 | */ |
483 | */ |
| 482 | } |
484 | } |
| 483 | 485 | ||
| Line 487... | Line 489... | ||
| 487 | * the configuration information for the specified CAN. |
489 | * the configuration information for the specified CAN. |
| 488 | * @retval None |
490 | * @retval None |
| 489 | */ |
491 | */ |
| 490 | __weak void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan) |
492 | __weak void HAL_CAN_MspDeInit(CAN_HandleTypeDef* hcan) |
| 491 | { |
493 | { |
| - | 494 | /* Prevent unused argument(s) compilation warning */ |
|
| - | 495 | UNUSED(hcan); |
|
| 492 | /* NOTE : This function Should not be modified, when the callback is needed, |
496 | /* NOTE : This function Should not be modified, when the callback is needed, |
| 493 | the HAL_CAN_MspDeInit can be implemented in the user file |
497 | the HAL_CAN_MspDeInit can be implemented in the user file |
| 494 | */ |
498 | */ |
| 495 | } |
499 | } |
| 496 | 500 | ||
| Line 1164... | Line 1168... | ||
| 1164 | } |
1168 | } |
| 1165 | 1169 | ||
| 1166 | /* Call the Error call Back in case of Errors */ |
1170 | /* Call the Error call Back in case of Errors */ |
| 1167 | if(hcan->ErrorCode != HAL_CAN_ERROR_NONE) |
1171 | if(hcan->ErrorCode != HAL_CAN_ERROR_NONE) |
| 1168 | { |
1172 | { |
| - | 1173 | /* Clear ERRI Flag */ |
|
| - | 1174 | hcan->Instance->MSR |= CAN_MSR_ERRI; |
|
| 1169 | /* Set the CAN state ready to be able to start again the process */ |
1175 | /* Set the CAN state ready to be able to start again the process */ |
| 1170 | hcan->State = HAL_CAN_STATE_READY; |
1176 | hcan->State = HAL_CAN_STATE_READY; |
| 1171 | 1177 | ||
| 1172 | /* Call Error callback function */ |
1178 | /* Call Error callback function */ |
| 1173 | HAL_CAN_ErrorCallback(hcan); |
1179 | HAL_CAN_ErrorCallback(hcan); |
| Line 1180... | Line 1186... | ||
| 1180 | * the configuration information for the specified CAN. |
1186 | * the configuration information for the specified CAN. |
| 1181 | * @retval None |
1187 | * @retval None |
| 1182 | */ |
1188 | */ |
| 1183 | __weak void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef* hcan) |
1189 | __weak void HAL_CAN_TxCpltCallback(CAN_HandleTypeDef* hcan) |
| 1184 | { |
1190 | { |
| - | 1191 | /* Prevent unused argument(s) compilation warning */ |
|
| - | 1192 | UNUSED(hcan); |
|
| 1185 | /* NOTE : This function Should not be modified, when the callback is needed, |
1193 | /* NOTE : This function Should not be modified, when the callback is needed, |
| 1186 | the HAL_CAN_TxCpltCallback can be implemented in the user file |
1194 | the HAL_CAN_TxCpltCallback can be implemented in the user file |
| 1187 | */ |
1195 | */ |
| 1188 | } |
1196 | } |
| 1189 | 1197 | ||
| Line 1193... | Line 1201... | ||
| 1193 | * the configuration information for the specified CAN. |
1201 | * the configuration information for the specified CAN. |
| 1194 | * @retval None |
1202 | * @retval None |
| 1195 | */ |
1203 | */ |
| 1196 | __weak void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef* hcan) |
1204 | __weak void HAL_CAN_RxCpltCallback(CAN_HandleTypeDef* hcan) |
| 1197 | { |
1205 | { |
| - | 1206 | /* Prevent unused argument(s) compilation warning */ |
|
| - | 1207 | UNUSED(hcan); |
|
| 1198 | /* NOTE : This function Should not be modified, when the callback is needed, |
1208 | /* NOTE : This function Should not be modified, when the callback is needed, |
| 1199 | the HAL_CAN_RxCpltCallback can be implemented in the user file |
1209 | the HAL_CAN_RxCpltCallback can be implemented in the user file |
| 1200 | */ |
1210 | */ |
| 1201 | } |
1211 | } |
| 1202 | 1212 | ||
| Line 1206... | Line 1216... | ||
| 1206 | * the configuration information for the specified CAN. |
1216 | * the configuration information for the specified CAN. |
| 1207 | * @retval None |
1217 | * @retval None |
| 1208 | */ |
1218 | */ |
| 1209 | __weak void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan) |
1219 | __weak void HAL_CAN_ErrorCallback(CAN_HandleTypeDef *hcan) |
| 1210 | { |
1220 | { |
| - | 1221 | /* Prevent unused argument(s) compilation warning */ |
|
| - | 1222 | UNUSED(hcan); |
|
| 1211 | /* NOTE : This function Should not be modified, when the callback is needed, |
1223 | /* NOTE : This function Should not be modified, when the callback is needed, |
| 1212 | the HAL_CAN_ErrorCallback can be implemented in the user file |
1224 | the HAL_CAN_ErrorCallback can be implemented in the user file |
| 1213 | */ |
1225 | */ |
| 1214 | } |
1226 | } |
| 1215 | 1227 | ||