crc.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /**
  2. ******************************************************************************
  3. * @file crc.c
  4. * @brief This file provides code for the configuration
  5. * of the CRC instances.
  6. ******************************************************************************
  7. * @attention
  8. *
  9. * <h2><center>&copy; Copyright (c) 2021 STMicroelectronics.
  10. * All rights reserved.</center></h2>
  11. *
  12. * This software component is licensed by ST under Ultimate Liberty license
  13. * SLA0044, the "License"; You may not use this file except in compliance with
  14. * the License. You may obtain a copy of the License at:
  15. * www.st.com/SLA0044
  16. *
  17. ******************************************************************************
  18. */
  19. /* Includes ------------------------------------------------------------------*/
  20. #include "crc.h"
  21. /* USER CODE BEGIN 0 */
  22. /* USER CODE END 0 */
  23. CRC_HandleTypeDef hcrc;
  24. /* CRC init function */
  25. void MX_CRC_Init(void) {
  26. /* USER CODE BEGIN CRC_Init 0 */
  27. /* USER CODE END CRC_Init 0 */
  28. /* USER CODE BEGIN CRC_Init 1 */
  29. /* USER CODE END CRC_Init 1 */
  30. hcrc.Instance = CRC;
  31. hcrc.Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_ENABLE;
  32. hcrc.Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_ENABLE;
  33. hcrc.Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_NONE;
  34. hcrc.Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_DISABLE;
  35. hcrc.InputDataFormat = CRC_INPUTDATA_FORMAT_BYTES;
  36. if(HAL_CRC_Init(&hcrc) != HAL_OK) {
  37. Error_Handler();
  38. }
  39. /* USER CODE BEGIN CRC_Init 2 */
  40. /* USER CODE END CRC_Init 2 */
  41. }
  42. void HAL_CRC_MspInit(CRC_HandleTypeDef* crcHandle) {
  43. if(crcHandle->Instance == CRC) {
  44. /* USER CODE BEGIN CRC_MspInit 0 */
  45. /* USER CODE END CRC_MspInit 0 */
  46. /* CRC clock enable */
  47. __HAL_RCC_CRC_CLK_ENABLE();
  48. /* USER CODE BEGIN CRC_MspInit 1 */
  49. /* USER CODE END CRC_MspInit 1 */
  50. }
  51. }
  52. void HAL_CRC_MspDeInit(CRC_HandleTypeDef* crcHandle) {
  53. if(crcHandle->Instance == CRC) {
  54. /* USER CODE BEGIN CRC_MspDeInit 0 */
  55. /* USER CODE END CRC_MspDeInit 0 */
  56. /* Peripheral clock disable */
  57. __HAL_RCC_CRC_CLK_DISABLE();
  58. /* USER CODE BEGIN CRC_MspDeInit 1 */
  59. /* USER CODE END CRC_MspDeInit 1 */
  60. }
  61. }
  62. /* USER CODE BEGIN 1 */
  63. /* USER CODE END 1 */
  64. /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/