source: trunk/firmware/CubeMX/Src/crc.c

Last change on this file was 1, checked in by f.jahn, 3 years ago
File size: 2.4 KB
RevLine 
[1]1/* USER CODE BEGIN Header */
2/**
3 ******************************************************************************
4 * @file crc.c
5 * @brief This file provides code for the configuration
6 * of the CRC instances.
7 ******************************************************************************
8 * @attention
9 *
10 * Copyright (c) 2022 STMicroelectronics.
11 * All rights reserved.
12 *
13 * This software is licensed under terms that can be found in the LICENSE file
14 * in the root directory of this software component.
15 * If no LICENSE file comes with this software, it is provided AS-IS.
16 *
17 ******************************************************************************
18 */
19/* USER CODE END Header */
20/* Includes ------------------------------------------------------------------*/
21#include "crc.h"
22
23/* USER CODE BEGIN 0 */
24
25/* USER CODE END 0 */
26
27CRC_HandleTypeDef hcrc;
28
29/* CRC init function */
30void MX_CRC_Init(void)
31{
32
33 /* USER CODE BEGIN CRC_Init 0 */
34
35 /* USER CODE END CRC_Init 0 */
36
37 /* USER CODE BEGIN CRC_Init 1 */
38
39 /* USER CODE END CRC_Init 1 */
40 hcrc.Instance = CRC;
41 hcrc.Init.DefaultPolynomialUse = DEFAULT_POLYNOMIAL_DISABLE;
42 hcrc.Init.DefaultInitValueUse = DEFAULT_INIT_VALUE_DISABLE;
43 hcrc.Init.GeneratingPolynomial = 7;
44 hcrc.Init.CRCLength = CRC_POLYLENGTH_8B;
45 hcrc.Init.InitValue = 0;
46 hcrc.Init.InputDataInversionMode = CRC_INPUTDATA_INVERSION_NONE;
47 hcrc.Init.OutputDataInversionMode = CRC_OUTPUTDATA_INVERSION_DISABLE;
48 hcrc.InputDataFormat = CRC_INPUTDATA_FORMAT_BYTES;
49 if (HAL_CRC_Init(&hcrc) != HAL_OK)
50 {
51 Error_Handler();
52 }
53 /* USER CODE BEGIN CRC_Init 2 */
54
55 /* USER CODE END CRC_Init 2 */
56
57}
58
59void HAL_CRC_MspInit(CRC_HandleTypeDef* crcHandle)
60{
61
62 if(crcHandle->Instance==CRC)
63 {
64 /* USER CODE BEGIN CRC_MspInit 0 */
65
66 /* USER CODE END CRC_MspInit 0 */
67 /* CRC clock enable */
68 __HAL_RCC_CRC_CLK_ENABLE();
69 /* USER CODE BEGIN CRC_MspInit 1 */
70
71 /* USER CODE END CRC_MspInit 1 */
72 }
73}
74
75void HAL_CRC_MspDeInit(CRC_HandleTypeDef* crcHandle)
76{
77
78 if(crcHandle->Instance==CRC)
79 {
80 /* USER CODE BEGIN CRC_MspDeInit 0 */
81
82 /* USER CODE END CRC_MspDeInit 0 */
83 /* Peripheral clock disable */
84 __HAL_RCC_CRC_CLK_DISABLE();
85 /* USER CODE BEGIN CRC_MspDeInit 1 */
86
87 /* USER CODE END CRC_MspDeInit 1 */
88 }
89}
90
91/* USER CODE BEGIN 1 */
92
93/* USER CODE END 1 */
Note: See TracBrowser for help on using the repository browser.